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

SanjayGMusafir

Well-known Member
Joined
Sep 7, 2018
Messages
1,513
Office Version
  1. 2024
Platform
  1. Windows
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

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
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,224,823
Messages
6,181,183
Members
453,020
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