ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Go to first available cell in A. (https://www.excelbanter.com/excel-programming/424565-go-first-available-cell.html)

J.W. Aldridge

Go to first available cell in A.
 
Simple, but having the hardest time...

Need to go to first available cell in column A, then clear contents of
all columns to the right and rows below.

(Thought I was getting good at this, but got stuck assembling this one
for some reason).

Mike H

Go to first available cell in A.
 
Hi,

Define more clearly what you mean by 'First available cell in Column A'

Mike

"J.W. Aldridge" wrote:

Simple, but having the hardest time...

Need to go to first available cell in column A, then clear contents of
all columns to the right and rows below.

(Thought I was getting good at this, but got stuck assembling this one
for some reason).


Ron de Bruin

Go to first available cell in A.
 
Define more clearly what you mean by 'First available cell in Column A'

Good point Mike

This will select the first empty cell in A
This is not always the cell below the last cell with data in A

Sub test()
On Error GoTo BodemUp
Columns("A").Cells.SpecialCells(xlCellTypeBlanks). Cells(1).Select
Exit Sub
BodemUp: Cells(Rows.Count, "A").End(xlUp)(2).Select
End Sub


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Mike H" wrote in message ...
Hi,

Define more clearly what you mean by 'First available cell in Column A'

Mike

"J.W. Aldridge" wrote:

Simple, but having the hardest time...

Need to go to first available cell in column A, then clear contents of
all columns to the right and rows below.

(Thought I was getting good at this, but got stuck assembling this one
for some reason).


J.W. Aldridge

Go to first available cell in A.
 
This one takes me to the last cell used.
I need the cursor to go to the next empty cell.
Then clear everything to the right and below.

Range("A2").Select
Selection.End(xlDown).Select

Mike H

Go to first available cell in A.
 
Hi,

In which case it sounds like you want this

FirstRow = Range("A2").End(xlDown).Row
lastrow = Cells.Find(What:="*", After:=[A1], SearchDirection:=xlPrevious).Row
Rows(FirstRow & ":" & lastrow).EntireRow.ClearContents


Mike

"J.W. Aldridge" wrote:

This one takes me to the last cell used.
I need the cursor to go to the next empty cell.
Then clear everything to the right and below.

Range("A2").Select
Selection.End(xlDown).Select



All times are GMT +1. The time now is 03:41 AM.

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