Change to UPPERCASE - My VBA Macro Imports lowercase data Sheet 1 to lowercase Sheet 2?

John.McLaughlin

Board Regular
Joined
Jul 19, 2011
Messages
169
Hello!

I use a basic order form clients fill out and send me. Then I have a VBA macro that reads every cell of the submitted form, and pastes the value into the corresponding "In House" form.

Trouble lately, a few people are sending everything in lower case. Can I modify my copy or paste command to convert this to uppercase?

Thanks in advance!

Code:
'copy the Cell from source book
    wbThis.Sheets("ORDER").Range("J4").Copy
    '
    'paste the data on the target book
    wbTarget.Sheets("ORDER").Range("F8").PasteSpecial xlPasteValues


    ' This is the end of code for individual cell copy ORDEREDBY
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
As it is only one cell, instead of copy and paste, just copy the value and convert it on the fly.
Code:
wbTarget.Sheets("ORDER").Range("F8").Value = UCase(wbThis.Sheets("ORDER").Range("J4"))
 
Upvote 0
My code is much faster now, thanks again!

I am trying to force a number format of "000.000", but it seems the target format overrides the "on the fly" source formula you showed me.
Code:
wbTarget.Sheets("SIZE").Range("D5").Value = Format(wbThis.Sheets("SIZE").Range("E3"), "000.000")

Can I change the target format?
 
Upvote 0
You need to do it like
Code:
With wbTarget.Sheets("SIZE").Range("D5")
   .Value = wbThis.Sheets("SIZE").Range("E3")
   .NumberFormat = "0.000"
End With
 
Upvote 0
You need to do the value and format separately otherwise the second part becomes a logical test, which is why you're seeing FALSE.
Code:
wbTarget.Sheets("SIZE").Range("D5").Value = wbThis.Sheets("SIZE").Range("E3")
wbTarget.Sheets("SIZE").Range("D5").NumberFormat = "0.000"
 
Upvote 0
You need to do it like
Code:
With wbTarget.Sheets("SIZE").Range("D5")
   .Value = wbThis.Sheets("SIZE").Range("E3")
   .NumberFormat = "0.000"
End With


Fluff, you are the greatest MOD ever!


You need to do the value and format separately otherwise the second part becomes a logical test, which is why you're seeing FALSE.
Code:
wbTarget.Sheets("SIZE").Range("D5").Value = wbThis.Sheets("SIZE").Range("E3")
wbTarget.Sheets("SIZE").Range("D5").NumberFormat = "0.000"


Thank you Jason, it did not occur to me split the command.


jasonb75, thank you for that bit of info. I was searching for the answer and my google-foo failed me.


I'm right there with you, if I only had a Keyword Thesaurus too :)


Thanks to all! You are the best!
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,196
Members
452,616
Latest member
intern444

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top