Simple problem in checking multiple sheets written cells

Klash Ville

Board Regular
Joined
Sep 19, 2017
Messages
83
For some reason, the code below, only the first variable ( i ) works, while the other one ( o ) doesn't, is simply ignored.

All I want to do is check if 2 sheets are empty or not (with no written cells).
Code:
For i = 1 To Worksheets.Count        
If Worksheets(i).Name = "Feuil1" Then
    exists = True
End If
    Next i
    If Not exists Then
        MsgBox "Apparently the sheet where you were suppose to upload an example of (Feuil1) doesn't exist" & vbNewLine & vbNewLine & _
        "• This is because it was either deleted or renamed into something different than its original name...", vbExclamation
        
        Sheets("Parameters").Select
        Exit Sub
    End If
    For o = 1 To Worksheets.Count
        If Worksheets(o).Name = "Country" Then
            exists = True
        End If
    Next o
    If Not exists Then
        MsgBox "Apparently the sheet where you were suppose to upload an example of (Country) doesn't exist" & vbNewLine & vbNewLine & _
        "• This is because it was either deleted or renamed into something different than its original name...", vbExclamation
        
        Sheets("Parameters").Select
        Exit Sub
    End If
 
Last edited:

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

Forum statistics

Threads
1,223,909
Messages
6,175,310
Members
452,634
Latest member
cpostell

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