![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Guest
Posts: n/a
|
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 |
|
|
|
#2 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Winnipeg
Posts: 2,330
|
Quote:
Range("A1", Range("I65536").End(xlUp).Address).Name = "DATABASE2060" Regards,
__________________
Barrie Davidson "You're only given a little spark of madness. You mustn't lose it." - Robin Williams |
|
|
|
|
|
|
#3 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Winnipeg
Posts: 2,330
|
Whoops, make that
Sheets("2060_DB").Range("A1", Sheets("2060_DB").Range("I65536").End(xlUp).Address).Name = "DATABASE2060"
__________________
Barrie Davidson "You're only given a little spark of madness. You mustn't lose it." - Robin Williams |
|
|
|
|
|
#4 |
|
Guest
Posts: n/a
|
Thanks
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|