VBA code for picking up undefined rows of data

VBA code for picking up undefined rows of data

Didn't find your answer?

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.

avatar
By User deleted
26th Oct 2007 09:11

Thank You
Richard,

Thank you very much.

Paul

Thanks (0)
avatar
By ACDWebb
26th Oct 2007 09:13

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

Thanks (0)