Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default 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!!!!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 747
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Quick VBA Worksheet Change Event or Selection Question: Damil4real Excel Worksheet Functions 6 November 17th 09 10:28 PM
Quick question Dr Fleau Excel Programming 3 July 28th 06 08:07 PM
Copy data from one worksheet to another using a function or a macr Sweetetc Excel Worksheet Functions 0 April 3rd 06 08:21 PM
Quick question - quick answer about assigning shortcut keys funkymonkUK[_75_] Excel Programming 1 October 13th 05 10:50 AM
Quick question DB100[_16_] Excel Programming 1 October 12th 04 03:07 PM


All times are GMT +1. The time now is 05:53 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"