Hi,
I'm putting together a process for some analysis work that is regularly undertaken. If I'm writing a piece of VBA rather than recording it how do I write it to pick up varying ranges. For example if the export from a database goes for 3,000 lines one week to 3,500 lines the next recording the code in the first week always runs the macro to row 3,000 so would miss out data in week 2. I know it's possible I just don't know how to do it.
All gifts of wisdom gratefully received!
Paul
Replies (2)
Please login or register to join the discussion.
You might also use either
Dim lastcell
lastcell = ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell).Row
Range("Top left cell", "Col Letter" & lastcell)
ie Range("A1", "B" & lastcell)
or
lastcell =ActiveSheet.UsedRange.Rows.Count
to get the bottom row