View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Refer to a different Worksheet regardless of which Worksheet I'm i

Hi C,

Try::

Worksheets("Program_Data_Input").Range("A3:G300"). ClearContents

Selections atr rarely necessary. Additionally, attempting to select a range
on a sheet other than the active sheet will cause a run-time error.

---
Regards,
Norman



"CRayF" wrote in message
...
I have 2 Worksheets in my Workbook: Program_Data_Input & Program_Summary

In the Macro I have a line:
Range("A3:G300").Select
Selection.ClearContents

This clears fine when I am on the Program_Data_Input Woorksheet.
I never want to update the Program_Summary Worksheet (I've protected it
just
in case).

If I were on the Program_Summary Worksheet and ran the macro there by
mistake (set to Ctrl+i) is there a way to hard code the macro to
explicitly
clear the Program_Data_Input Worksheet regardless of which Worksheet I'm
in?

I tried using this instead but got an error:
Worksheets("Program_Data_Input").Range("A3:G300"). Select
Selection.ClearContents