VBA Code to Ctrl+Home in Freeze Panes ignoring Hidden Cells

SanjayGMusafir

Well-known Member
Joined
Sep 7, 2018
Messages
1,450
Office Version
  1. 2021
Platform
  1. MacOS
In most of my Excel sheets, I use Freeze Panes. And to keep my work visibly tidy, I hide rows.

Now, I have VBA to reach First Cell after Frozen Pane. And also, VBA for ignoring Hidden Rows. But when I combine both to reach First Visible Cell - It takes a lot of time.

I strongly believe that there must be a better way of doing things than I'm doing right now. So Please help me with a refined and faster way to get the intended results. Thanks

The code I'm using right now is as under -

Cells(ActiveWindow.SplitRow + 1, ActiveWindow.SplitColumn + 1).Select

Do Until Selection.EntireRow.Hidden = False

If Selection.EntireRow.Hidden = True Then
ActiveCell.Offset(1, 0).Activate
End If

Loop
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
This avoids looping
Code:
With ActiveSheet
    With Range(.Cells(1, 1), .UsedRange)
        With .Offset(ActiveWindow.SplitRow, ActiveWindow.SplitColumn).SpecialCells(xlCellTypeVisible)
            .Cells(1, 1).Select
        End With
    End With
End With
 
Upvote 0

Forum statistics

Threads
1,215,064
Messages
6,122,937
Members
449,094
Latest member
teemeren

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