Relative reference and macros

C

Cutter

What code would you use to go from one sheet to a named sheet and the
return to the original sheet (but without having to name the origina
sheet)
 
J

JE McGimpsey

I would almost never "go to" another sheet. For example:

Sheets("Sheet2").Range("A1:J10").Copy Destination:= _
ActiveSheet.Range("B13")

copies from Sheet2 to the active sheet without ever changing the
selection. Using the range object directly makes your code smaller,
faster, and IMO, easier to maintain.

However, to do what you're asking:

Dim shOriginal As Worksheet
Set shOriginal = ActiveSheet
Sheets("Sheet2").Select

'Do whatever

shOriginal.Select
 
Top