Skipping Empty Sheets

a long time ago

New Member
Joined
Nov 29, 2010
Messages
3
Hi All,

I am trying to find a solution about skipping the blank sheets and then selecting the first the sheet which contains a data.

For example, I have 8 sheets and only the sheet3 contains data. My aim is to select this sheet with a macro?

Any help would be appreciated.

Thanks,
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
As long as the blank sheets are truly 'clean', maybe we coud use UsedRange.
Rich (BB code):
Option Explicit
    
Sub exa2()
Dim i As Long
    
    For i = 1 To ThisWorkbook.Worksheets.Count
        With ThisWorkbook.Worksheets(i)
            If Not (.UsedRange.Cells.Count = 1 _
                    And .UsedRange.Address = "$A$1" _
                    And .Cells(1) = vbNullString) Then
                
                .Select
                Exit For
            End If
        End With
    Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,217,386
Messages
6,136,284
Members
450,002
Latest member
bybynhoc

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