ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to goto the next available cell in a column. (https://www.excelbanter.com/excel-programming/376038-how-goto-next-available-cell-column.html)

[email protected]

How to goto the next available cell in a column.
 
Hi,

I'm pretty stuck with this.

In an Excel worksheet using VB I want to be able to goto the next
available cell in a column.

I've looked at / tried to butcher the following script which returns
the No of the row of the next blank cell in column A but I would like
it to activate this cell.

Sub FindLastCell()
Dim LastCell As Range
With ActiveSheet
Set LastCell = .Cells(.Rows.Count, "A").End(xlUp)
If IsEmpty(LastCell) Then
'do nothing
Else
Set LastCell = LastCell.Offset(1, 0)
End If
End With
MsgBox LastCell.Row
End Sub

Please - any advice would be gratefully received.

Cheers


Jim Thomlinson

How to goto the next available cell in a column.
 
Sub FindLastCell()
Dim LastCell As Range
With ActiveSheet
Set LastCell = .Cells(.Rows.Count, "A").End(xlUp)
If Not IsEmpty(LastCell) Then
Set LastCell = LastCell.Offset(1, 0)
End If
End With
MsgBox LastCell.Row
LastCell.Select
End Sub

--
HTH...

Jim Thomlinson


" wrote:

Hi,

I'm pretty stuck with this.

In an Excel worksheet using VB I want to be able to goto the next
available cell in a column.

I've looked at / tried to butcher the following script which returns
the No of the row of the next blank cell in column A but I would like
it to activate this cell.

Sub FindLastCell()
Dim LastCell As Range
With ActiveSheet
Set LastCell = .Cells(.Rows.Count, "A").End(xlUp)
If IsEmpty(LastCell) Then
'do nothing
Else
Set LastCell = LastCell.Offset(1, 0)
End If
End With
MsgBox LastCell.Row
End Sub

Please - any advice would be gratefully received.

Cheers




All times are GMT +1. The time now is 12:17 AM.

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