View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JE McGimpsey JE McGimpsey is offline
external usenet poster
 
Posts: 4,624
Default Active sheet instead of a "sheet1" for Macro

One way:

If ActiveSheet.Range("A1").Value = True Then
ActiveSheet.Range("C11:C7").Copy
End If

Or, equivalently:

With ActiveSheet
If .Range("A1").Value = True Then .Range("C11:C17").Copy
End With


In article
,
Pantera wrote:

I have this code in a macro:
If Sheets("Sheet1").[A1] = True Then
ActiveWindow.SmallScroll Down:=-9
Application.Goto Reference:="R17C3"
Range("C11:C17").Select
Range("C17").Activate
Selection.Copy

My questions is how do I make this macro work in any worksheet not
only only in sheet1, what do i have to change from "Sheet1" to make it
work.
thank you,

Pamela