Hi!
I’m trying to do a macro that define a new database area from cell A1 to the cell at the r:th row and c:th column. How can I use a reference that takes variables as argument? Like for example, Cells(r, c)?
I can select the new area with this code.
But how do I set the new database area to the selected area? If a record a macro I get:
But in this code the row and column numbers are fixed.
I’ve tried to use the
formula to convert between A1 and R1C1 (thinking I could use cells(r,c)), but it didn’t work, perhaps I don’t understand the syntax.
Can someone help me?
Regards /HL
I’m trying to do a macro that define a new database area from cell A1 to the cell at the r:th row and c:th column. How can I use a reference that takes variables as argument? Like for example, Cells(r, c)?
I can select the new area with this code.
Code:
range(Cells(10, 1), Cells(r, c)).Select
Code:
ActiveWorkbook.Names.Add Name:="Portfolios", RefersToR1C1:= "=Port!R10C1:R123C36"
I’ve tried to use the
Code:
convertFormula
Can someone help me?
Regards /HL