ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Quick question about moving around a worksheet using vba in a macr (https://www.excelbanter.com/excel-programming/369691-quick-question-about-moving-around-worksheet-using-vba-macr.html)

Still Learning

Quick question about moving around a worksheet using vba in a macr
 
What vba snipet can I use to select the next empty cell in column A (at the
bottom of my data) without referencing a specific cell?

For example I need to be able to go to the bottom of the data, but the
amount of data may vary so I need to be able to select the next empty cell in
a column without referencing a specific cell because the bottom of the data
won't be the same cell every time.

I've tried to just record a macro and press ctrl shift down or something
like that, but in the recorded macro it just references the cell at the
bottom of the data that the shortcut went to, not "the bottom of the data
that may vary based on what data I start with"

I apprecite all help!!!

Oh and I can't use addins because it will be a part of a much larger macro
so I'm hoping to have a code that doesn't have any manual work to it at all.

So much thanks!!!!

Greg Wilson

Quick question about moving around a worksheet using vba in a macr
 
To return the next empty cell starting at A2 looking down the column:

Dim c As Range
Set c = Range("A2").End(xlDown).Offset(1)
c.Select

The above will find a gap in the data if it exists. If you potentially have
gaps in your data and don't want to stop there but want the next empty cell
below the last cell in column A containing data:

Dim c As Range
Set c = Cells(Rows.Count, 1).End(xlUp).Offset(1)
c.Select

Regards,
Greg





All times are GMT +1. The time now is 07:27 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com