VBA to Jump to the last row excluding blanks

SanjayGMusafir

Well-known Member
Joined
Sep 7, 2018
Messages
1,503
Office Version
  1. 2021
Platform
  1. MacOS
Hi Experts,

I got the underneath VBA from this forum itself. It was (is) working fine. But recently to make my work faster, I have added few blank rows at the bottom. Number of blank rows to my structured table keep varying depending upon how many I used and how many I may randomly add.

So can there be some improvement in VBA to skip the blank rows and go to the last active row of the table.

Just to help, if it may, the rows that I add to the table are automatically filled with table formulae, which give Blank value until I input some data in Column H

Thanks in advance

Much appreciated

VBA Code:
Sub GoClientsBottom()
'
' GoClientsBottom Macro
'

'
    Sheets("Client").Select
    
    'To reset Zoom levels of the sheet
    Call ZoomReset
    
    Dim LRow As Long
    Dim LCol As Long
    LRow = Cells(Rows.Count, 1).End(xlUp).Row
    LCol = ActiveCell.Column
    
    'To go to last active row of the same Active column
    Cells(LRow, LCol).Select
    
    If ActiveCell.HasFormula Then
        Exit Sub
    Else
        ActiveCell.End(xlUp).Select
        Range(ActiveCell.Offset(1, 0), ActiveCell.Offset(1, 0)).Select
    End If
    
    'ActiveWorkbook.Save
    
End Sub
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Not quite sure I understand what you are asking (so much depends on the structure of the data).
Can you show us an example of your data, and explain exactly what it is you are trying to do, in relation to that example?

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
 
Upvote 0
Hi @Joe4
Thanks for reverting

I would have certainly posted a sample data but my database to so big It won't get copied and pasted here.

Just for your understanding the above code is to go to the bottom of a current column in my structured table.
Then I improvised by adding Cells(LRow, LCol).End(xlUp).Select and realised that when a column contains a formula it jumps to the first row of the table.

So trying to figure out a way where it can move up only until the formula returns NOT a blank value. If you may please help...

Until then I'm working with following to stop at the last cell but it adds to my work than easing out...

VBA Code:
If ActiveCell.HasFormula Then
        Exit Sub
    Else
        ActiveCell.End(xlUp).Select
        Range(ActiveCell.Offset(1, 0), ActiveCell.Offset(1, 0)).Select
    End If

Thanks again.
 
Upvote 0
You are welcome!
Glad we were able to help.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,244
Members
452,622
Latest member
Laura_PinksBTHFT

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