Code amendment needed for getting missing numbers from a range, checking multiple sheets intead of just a single sheet.

kelly mort

Well-known Member
Joined
Apr 10, 2017
Messages
2,169
Office Version
  1. 2016
Platform
  1. Windows
This is what I am having currently and it's working very fine - with a single sheet.

Now what I want to achieve is to be able to get the missing numbers from multiple sheets.

For now I have 6 sheets that I want to check for the missing number(s).

My sheets have the naming structure as below:
Code:
Data 1, Data 2, Data 3, 1st Report, 2nd Report, Products
I am showing this structure so that those willing to assist me with the code will have a clear view of what to expect so that they don't assume my sheets are continuous, like Sheet1, ....., sheet6.

I know the above sheet names don't actually sound cool enough but for now, let us forget about how cool those names are (they are just samples).

Some of the sheets might be blank. Which means they might not have data from row 4 downloads (as defined in my code below).
Which means that we have to skip all those blank sheets and only check for the non-blank sheets.

Thanks in advance.

Code:
Sub GetMissingNum ()
Dim e&, i&, lr&, sh As Worksheet 

e = 0
Set sh = Sheet1.Cells (Rows.Count, "A").End (xlUp).Row
If lr < 4 Then lr = 4

With sh.Range("A4:A" & lr)
     Do 
        e = e + 1
     Loop Until IsError(Application.Match(e, .Cells, 0))

     MsgBox e 
End With 

End Sub
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Forum statistics

Threads
1,214,951
Messages
6,122,446
Members
449,083
Latest member
Ava19

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