LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default 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
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Test cell interior color by worksheet function? Skimmer Excel Worksheet Functions 7 September 4th 07 09:40 PM
Merged Cells in Worksheet, Test for [email protected] Excel Discussion (Misc queries) 2 September 28th 06 05:09 PM
If a worksheet name is = to test then a msgbox appears Vick Excel Discussion (Misc queries) 1 December 21st 05 11:17 PM
How can I test when any worksheet within a workbook is selected Peter McNaughton Excel Programming 2 January 29th 04 04:59 AM
Test to see if a worksheet exists thanks, Chip CT[_2_] Excel Programming 0 August 22nd 03 03:17 AM


All times are GMT +1. The time now is 11:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"