BarryOTO
asked on
Trying to name a range of cells as "database" in a macro
When I try to name a range of cells as "database" in a marco sequence, Visual Basic gives me the following result:
Range(Selection, Selection.End(xlDown)).Sel ect
Range(Selection, Selection.End(xlToRight)). Select
ActiveWorkbook.Names.Add Name:="database", RefersToR1C1:= _
"='2521'!R31C3:R6651C6"
My problem is I want to use the sequence with various different workbooks. This macro was created with an imported document named '2521' It seems if I want to use the macro with another document, Visual Basic still returns the information based on the earlier document namd.
I did select "relative reference" when I used the macro but that doesn't seem to solve the problem.
I would very much appreciate any help you could provide.
Thank you
Barry
Range(Selection, Selection.End(xlDown)).Sel
Range(Selection, Selection.End(xlToRight)).
ActiveWorkbook.Names.Add Name:="database", RefersToR1C1:= _
"='2521'!R31C3:R6651C6"
My problem is I want to use the sequence with various different workbooks. This macro was created with an imported document named '2521' It seems if I want to use the macro with another document, Visual Basic still returns the information based on the earlier document namd.
I did select "relative reference" when I used the macro but that doesn't seem to solve the problem.
I would very much appreciate any help you could provide.
Thank you
Barry
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Thank you, Barry. I'm glad I could help.
-Dennis Borg
-Dennis Borg
ASKER