Mitch Swetsky
asked on
How can I get the range of the activecell and assign it to a varable
I need to revisit the same cell later in my sub but am having a hard time setting a var = activecell
I want to navigate to the first blank col then run vlookup from other open sheet and go back to active cell and fill down to the last row.
Code below is just a snip of my project.
I want to navigate to the first blank col then run vlookup from other open sheet and go back to active cell and fill down to the last row.
Code below is just a snip of my project.
Sheets("Actual & Flexed Workload").Activate
lastRow = Range("A" & Rows.Count).End(xlUp).Row 'Get last row to fill down
Range("B3").Select 'Get consistent begin cell
' Most likely will be january and each month I will get new month column
Selection.End(xlToRight).Select 'move to end of row to add new month data in that col
ActiveCell.Offset(0, 1).Select
' I need to get this cell range and save as rngFound so after getting data from another sheet I can come back and paste in this column
'Poor effort of catching active cell
AFWrow = ActiveCell.Row
AFWcol = ActiveCell.Column
rngFound = Range("R" & AFWrow & "C" AFWcol ")
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC[-8],P01Currentmonth.csv!R1C24:R +lastRow+ C29,6,FALSE)"
Windows("2011 U.S. Financial Plan.xls").Activate
rngFound.Select
Selection.AutoFill Destination:=Range(rngFound)
Range(rngFound).Select
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER