VBA code error

jakobt

Active Member
Joined
May 31, 2010
Messages
337
Writing this code:
Receives error: Compile error - Method or data member not found.

Sub Sizing()




Range("a1:J125").Select
With Selection.Font
.Name = "Arial"
.size = 8

End With
End Sub
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Is that the full code? You don't need .Select, this works on a new sheet just tested on:
Code:
Sub Sizing()

With Range("A1:J125").Font
    .Name = "Arial"
    .Size = 8
End With

End Sub
 
Last edited:
Upvote 0
Mohan, that will generate a run time 1004 error if Sheet1 is not the active sheet
 
Upvote 0
When running this code: Get the error:
Compile error: Ambigorous name detected: Sizing.

(Saved the code in personal macro book and run it from here). Is it possible to adjust the code so it can be stored and run from the personal macro book.
 
Upvote 0
You have two macros with the same name "Sizing" it doesn't know which macro to compile
 
Upvote 0

Forum statistics

Threads
1,214,659
Messages
6,120,786
Members
448,992
Latest member
prabhuk279

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