Range Object error
i All
This maybe a newby question but I have searched for an answer without any
luck.
When i attach the following code to a command button click event
Private Sub TestButton_Click()
Range(Cells(1, 1), Cells(5, 3)).Font.Italic = True ' This works fine
Worksheets("Data").Range(Cells(1, 1), Cells(5, 3)).Font.Italic = True '
This produces a 1004 error
Worksheets("Data").Range("J3:J6").Value = "Hello" ' This works fine
Worksheets("Data").Range(Cells(3, 10), Cells(6, 10)).Value = "World" '
This produces a 1004 error
Set myRange1 = Worksheets("Data").Range("J3:J6") 'This works fine
Set myRange2 = Worksheets("Data").Range(Cells(3, 10), Cells(6, 10)) '
This produces a 1004 error
End Sub
I am obviously referencing the RANGE object incorrectly but I dont see how.
Is there anothe way people use to reference a multicell range using numeric
veriables??
Thanks for your assistance
Lance
|