Test for Worksheet
The code below is an excerpt from a larger macro. I am
working in worksheet "A" and want to activate a worksheet
called "B", if it exists. The way the code is written now,
I imagine that the macro will error out if it does not
find a worksheet named "B."
What code can I build in to ignore this section of code if
the worksheet does not exist?
TIA.
(I am working in worksheet "A" before I get to this
section of code.)
Workbooks("FIR_PATs.xls").Worksheets("B").Activate
total_row = Range("A65536").End(xlUp).Row
Range("A" & total_row - 2).Select
With ActiveCell
TtlD = .Offset(0, 3).Value
TtlE = .Offset(0, 4).Value
TtlF = .Offset(0, 5).Value
TtlG = .Offset(0, 6).Value
TtlH = .Offset(0, 7).Value
TtlI = .Offset(0, 8).Value
End With
|