apply formula to one column within a set range (easy!)

nowanda

Board Regular
Joined
May 27, 2002
Messages
67
Hello All!

This is a simple question as I'm sure I'm missing something small ->

I need to make one column (text) uppercase. If I do the following I make all of the columns with text uppercase...

Sub MakeCaps()
For Each x In ActiveCell.CurrentRegion.Cells
x.Value = UCase(x.Value)
Next
End Sub

What's the syntax to include one column in the range to the end of the sheet? (i.e. column A within a sheet of 100 rows - I don't want to run the script to eternity - I'd like it to run to the last cell containing an entry!)

Thanks!
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Here's a way:

Sub Up_Case()
Set my_col = Range([a1], [A65536].End(xlUp))
For Each x In my_col.Cells
Range(x.Address) = UCase(x)
Next
End Sub

This will work assuming it's column A. Oherwise, change [A1] and [A65336] in the Set statement
 
Upvote 0

Forum statistics

Threads
1,203,205
Messages
6,054,136
Members
444,703
Latest member
pinkyar23

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