G
Guest
Guest
Hi guys,
I recorded this macro..
ActiveWorkbook.Names.Add Name:="DATABASE2060", RefersToR1C1:= _
"='2060_DB'!R1C1:R8C9"
Now, I am trying to achieve the same result using VBA.
My code
Set LastCell = ActiveSheet.Range("I65536").End(xlUp)
SV_Code = 2060
Reference = "='" & SV_Code & "_DB!R1C1:" & LastCell.Address(ReferenceStyle:=xlR1C1)
ActiveWorkbook.Names.Add Name:="DATABASE2060", RefersToR1C1:= _
Reference
Running the vba code doesn't achieve the same result. Help guys
I recorded this macro..
ActiveWorkbook.Names.Add Name:="DATABASE2060", RefersToR1C1:= _
"='2060_DB'!R1C1:R8C9"
Now, I am trying to achieve the same result using VBA.
My code
Set LastCell = ActiveSheet.Range("I65536").End(xlUp)
SV_Code = 2060
Reference = "='" & SV_Code & "_DB!R1C1:" & LastCell.Address(ReferenceStyle:=xlR1C1)
ActiveWorkbook.Names.Add Name:="DATABASE2060", RefersToR1C1:= _
Reference
Running the vba code doesn't achieve the same result. Help guys