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

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
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,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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