In Excel, ctrl + end will go to the last cell with a value.
But this will be tricky if you have deleted the last row with a value or has deleted its contents on the cell. Since it will be recoded as the last cell that has a value or the user has inputted or type on that specific cell.
And Excel will still remember it as the last type cell
with value. Pressing ctrl + end will still go there, thus provide the wrong
result. However, to prevent this from happening you need to close the workbook and open it again.
Then pressing ctrl + end will show the last row with value. But while the worksheet is active any last typed cell even though its content or deleted will be considered as the last row.
Getting the last row with data even without closing the workbook can be done via this simple
VBA code below.
One caveat though, this will only search for the defined row
within the VBA code and the number of rows to be checked has to be defined on
the code also.
So, type a number that
is quite large that is way beyond the number of lines that you expected.
Sub FindRowWithValue()
Dim i, xi, xloop As Integer
Dim s As String
xloop = 0
xi = 0
For xloop = 1 To 10000 ‘check cell A1 to A 10k
s = Cells(xloop,
1).Value ‘(xloop is row, 1 is column which is A)
i = Len(s) ‘check
the length of the value 0 means no value
If i
> 0 Then
xi = xloop
End If
Next xloop
MsgBox ("Last row with data or valus is A" &
xi) ‘display the last row with value
End Sub
If need to check from row 10,001 onwards may result to
runtime error 6 and overflow error.
So, to overcome this error; change the for-loop value.
Example change xloop to this:
For xloop = 12000 To 10001 Step -1
This will check row 10,001 until row 12,000
And just changed the number to any desired value to continue checking.
If the any last cell with has a value on the specified range, then that row will be returned.
To go to the specific last row, press ctrl + g then on the “reference”
value type: A plus the last row value that was returned.
Example, if the msgbox value shows: A10675 then enter same
value on reference value after pressing ctrl + g.
Till next time. Stay safe! and keep things up!
Do ASAP, Always Say A Prayer...
================================
Free Android Apps:
Click links below to find out more:
Free Android Apps:
Click links below to find out more:
Excel Keyboard guide:
https://play.google.com/store/apps/details?id=chrisjoms.myexcelapplicationguide
Heaven's Dew Fall Prayer app for Android :
https://play.google.com/store/apps/details?id=soulrefresh.beautiful.prayer
Catholic Rosary Guide for Android:
Pray the Rosary every day, countless blessings will be showered upon your life if you recite the Rosary faithfully.
https://play.google.com/store/apps/details?id=com.myrosaryapp
Divine Mercy Chaplet Guide (A Powerful prayer) BFF = Be Filled Faith:
Comments
Post a Comment