VBA function to turn all capitols in a cell

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Try:

Code:
Sub upper()
With Range("A1")
    .Value = UCase(.Value)
End With
End Sub
 
Upvote 0
In fact just in case you have formula producing the words you could use .Formula instead of .Value
 
Upvote 0
.. or if users are entering data manually, you can force them to use upper case in the first place with Data Validation like this*
Data Validation -> Settings tab -> Allow: Custom -> Formula: =EXACT(A1,UPPER(A1)) -> (Optional add a message on the Error Alert tab) -> OK

* Rider that Data Validation is easily defeated by Copy/Paste.



In fact just in case you have formula producing the words you could use .Formula instead of .Value
I'm not following that?
 
Upvote 0
Lets say the cell A1 houses =IF(B1="","boo",""). If B1 was empy then A1 would say boo. If the OP used my original macro then boo would read BOO but the formula would gone. Using .Formula the cell would say =IF(B1="","BOO",""). Ill just test that!
 
Upvote 0
Lets say the cell A1 houses =IF(B1="","boo",""). If B1 was empy then A1 would say boo. If the OP used my original macro then boo would read BOO but the formula would gone. Using .Formula the cell would say =IF(B1="","BOO",""). Ill just test that!
Ah, I understand where you are coming from. :)

However, what if A1 housed the formula
=IF(B1="","",B1)
and B1 housed the text "boo"?
 
Upvote 0
I suppose this could be solved by using UPPER(B1)? Then the formula are still preserved.
 
Upvote 0
I suppose this could be solved by using UPPER(B1)? Then the formula are still preserved.
Possibly, but we are probably at the point where we need some more info from the OP about just what they have and what they are trying to achieve. :)
 
Upvote 0

Forum statistics

Threads
1,214,945
Messages
6,122,397
Members
449,081
Latest member
JAMES KECULAH

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