Recorded macro placed in code shows not supported

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,737
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

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Glad we could help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,252
Members
452,623
Latest member
Techenthusiast

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