Select First cell in A Column after the last row which have a data Either in column A, B or C

ala995

New Member
Joined
Aug 15, 2022
Messages
11
Office Version
  1. 2021
Platform
  1. Windows
Hello,
The question is as stated in the title.
I have data on the current Sheet and I want to write on the first empty row after
The rows that contain the data.
Note: Column A may be empty and Column B may contain data
I want to write the data after the last row containing data, whether in column A or B or or C...etc

This is the last result I reached, but the problem this code is select the entire row and I only want to select the first cell in the row to write on

VBA Code:
Sub Range_Find_Method()
'Finds the last non-blank cell on a sheet/range.

Dim lRow As Long
Dim lCol As Long
    
    lRow = Cells.Find(What:="*", _
                    After:=Range("A1"), _
                    LookAt:=xlPart, _
                    LookIn:=xlFormulas, _
                    SearchOrder:=xlByRows, _
                    SearchDirection:=xlPrevious, _
                    MatchCase:=False).Row


Rows(lRow).Select
    MsgBox "Last Row: " & lRow

End Sub
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
In this case I would use instead:
VBA Code:
lRow = Cells.Find("*", , , , xlByRows, xlPrevious).Row + 1
it will detect the highest row number of all used columns.
 
Upvote 0
Try:
VBA Code:
Sub SelectRange()
    Dim lRow As Long
    lRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1
    Range("A" & lRow).Select
    MsgBox "Last Row: " & lRow
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,223,908
Messages
6,175,307
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top