Hey Everyone,
I was wondering if it were possible to use variables to reference cell values in a range to merge?
I am using Excel 2013.
Here is my current code:
I am currently getting the following error:
Runtime error 1004
Method 'Range' of object '_Global' failed
I have been searching the web and have seen most people using code such as:
but would prefer not to do if I can. Want to be able to change the StartRange and EndRange on the fly if I have to.
I have in mind to use these variables later in the function as well for cell formatting.
Thanks in advance
later
Ty
I was wondering if it were possible to use variables to reference cell values in a range to merge?
I am using Excel 2013.
Here is my current code:
Code:
Sub CompanyHeader()
Dim StartRange as String
Dim EndRange as String
StartRange = "A1"
EndRange = "J3"
Range("StartRange:EndRange").Merge
End Sub
I am currently getting the following error:
Runtime error 1004
Method 'Range' of object '_Global' failed
I have been searching the web and have seen most people using code such as:
Code:
Range(Cells(1,1), Cells(3,4))
but would prefer not to do if I can. Want to be able to change the StartRange and EndRange on the fly if I have to.
I have in mind to use these variables later in the function as well for cell formatting.
Thanks in advance
later
Ty