- Local time
- Today, 16:02
- Joined
- Sep 12, 2006
- Messages
- 16,026
Struggling to manipulate a spreadsheet
I have a block of cells = eg A1:L254, although there is then further data beneath this block.
I want to find the last populated row in the block (ie 254)
I have code to find the maximum extent of the spreadsheet, but as there is stuff below the datablokc, this doesnt quite work.
Over time, new rows may be entered/deleted, so the last item wont then be in row 254, so I cant hard code it.
----------
FIRST APPROACH
is there an easy vba code to examine the block to do this. I can give the data block a name if that helps
----------
ALTERNATIVE APPROACH
As I cant do this yet, as an aternative to this, I am storing the row number I need in a separate cell (B258). which is therefore the last populated cell in column B. But as I add/delete rows in the data block, this moves the position of cell B258 up or down respectively. At the moment my code examines B258 to get the range - but as I insert/delete rows, the right cell yto use wont be B258.
So instead, is there a way of finding the last populated cell in a given column, with code
-------------
Thanks in anticipation
I have a block of cells = eg A1:L254, although there is then further data beneath this block.
I want to find the last populated row in the block (ie 254)
I have code to find the maximum extent of the spreadsheet, but as there is stuff below the datablokc, this doesnt quite work.
Over time, new rows may be entered/deleted, so the last item wont then be in row 254, so I cant hard code it.
----------
FIRST APPROACH
is there an easy vba code to examine the block to do this. I can give the data block a name if that helps
----------
ALTERNATIVE APPROACH
As I cant do this yet, as an aternative to this, I am storing the row number I need in a separate cell (B258). which is therefore the last populated cell in column B. But as I add/delete rows in the data block, this moves the position of cell B258 up or down respectively. At the moment my code examines B258 to get the range - but as I insert/delete rows, the right cell yto use wont be B258.
So instead, is there a way of finding the last populated cell in a given column, with code
-------------
Thanks in anticipation