Macro Help...Skipping tabs not present

Hi,

I recorded a macro that essentially grabs tabs from a source spreadsheet, titles them, and saves them in an appropriate folder. The problem begins when the source spreadsheet comes in next month without one of the tabs that was present in the prior month. What is the easiest way to tell the macro to skip grabbing the tab if it isn't present? Currently, the macro bugs out when the source sheet is missing a tab that was present in the prior month. Thanks is advance.
cdcamp77Asked:
Who is Participating?
 
nutschConnect With a Mentor Commented:
you can do

on error resume next
debug.print sheets("Missing tab").cells(1,1)

if err=0 then
'tab Missing tab exists
else
'tab Missing tab doesn't exist
err.clear
end if

on error goto 0

Open in new window


Thomas
0
 
aikimarkConnect With a Mentor Commented:
Iterate the worksheets as a collection, rather than by name.
Example:
Dim wks As Worksheet
For Each wks In ActiveWorkbook.Worksheets
    'put your processing code here
Next

Open in new window

0
 
Martin LissOlder than dirtCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.