I have the following Code:
I need a way to tell the macro to run only if the worksheet exist. For example, if Worksheet(4) does not exist, then I do not want that portion of the code above to run.Code:With ActiveSheet LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row + 1 Worksheets(2).Select Range("A1:F85").Select Selection.Copy Sheets(1).Select Range("A" & LastRow).Select ActiveSheet.Paste Range("A1").Select End With With ActiveSheet LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row + 1 Worksheets(3).Select Range("A1:F85").Select Selection.Copy Sheets(1).Select Range("A" & LastRow).Select ActiveSheet.Paste Range("A1").Select End With With ActiveSheet LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row + 1 Worksheets(4).Select Range("A1:F85").Select Selection.Copy Sheets(1).Select Range("A" & LastRow).Select ActiveSheet.Paste Range("A1").Select End With


Reply With Quote


Bookmarks