How do I create a master list of formatting attributes for the purposes of affecting multiple ranges simultaneously?
For example, let's say I want the same format for the following defined ranges:
I tried:
Instead of success, I receive the following message: "Compile error: With object must be user-defined type, Object, or Variant"
Any suggestions on how to accomplish what I am trying to do?
For example, let's say I want the same format for the following defined ranges:
Code:
Dim r2,r3 As Range
Set r2 = Sheets("2").Range("B3:I502")
Set r3 = Sheets("3").Range("B3:B1002")
I tried:
Code:
Dim MasterFormat As String
With MasterFormat
.ClearFormats
.Borders.Weight = xlThin
.Font.Size = 10
.Font.Name = "Arial"
.VerticalAlignment = xlCenter
.Locked = False
End With
r2.MasterFormat
r3.MasterFormat
Instead of success, I receive the following message: "Compile error: With object must be user-defined type, Object, or Variant"
Any suggestions on how to accomplish what I am trying to do?