Recorded macro placed in code shows not supported

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,199
Office Version
  1. 2007
Platform
  1. Windows
Hi,
I have the following working code in use.

Code:
Private Sub Worksheet_Activate()  Range("A3") = UCase(Format(Now, "mmmm"))
  Range("D3") = Year(Now)
  Range("A1:E3").HorizontalAlignment = xlCenter
  Range("A1:E3").VerticalAlignment = xlCenter
  Range("A1:E30, D31:E31, B35:C37, E35:E37 ").Borders.LineStyle = xlContinuous
  Range("A5").Select
  
End Sub

I then recorded a macro to format a range to TEXT of which is shown below,

Code:
Range("A5:A30").Selection.NumberFormat = "@"

When i add this line of code to the Activate code i am told not supported.
My goal is when the worksheet is opened the range will always be TEXT format.

Can you please advise.
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Try:
Code:
 Range("A5:A30").NumberFormat = "@"
 
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,213,534
Messages
6,114,185
Members
448,554
Latest member
Gleisner2

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