Sub A1 Line Malfunction

  • Thread starter Thread starter Phil Hageman
  • Start date Start date
P

Phil Hageman

The Sub below is attached to a forms control button, and
the line Range ("A1").Select is not working. Can someone
help correct this?

Sub GoToMetric1()
Application.ScreenUpdating = False
Sheets("Metrics").Select
Range("A1").Select
ActiveWindow.Zoom = 57
With ActiveSheet.ChartObjects("Chart 13")
.Height = 660
.Width = 780
.Top = 10
.Left = 125
.BringToFront
End With
Application.ScreenUpdating = True
End Sub
 
Why something "is not working" is almost always impossible to diagnose.
Would you care to share some details? What happens? Is there an error
message? If so, what is it? If not, does the rest of the Sub continue? Do
you have the code in a standard module? And why do you want to select A1
anyway?
 
Is your code in a General module--or under a worksheet?

(Try putting it in a general module if it's not there already.)
 
And just to add, if it's under a worksheet module, then this line:
Range("A1").Select
has a problem.

Range("a1") is an unqualified reference. In a general module, it'll refer to
the activesheet. But behind a worksheet, it refers to the sheet containing the
code.

And you can't select a range on a sheet that isn't active. (and Metrics is the
active sheet).
 
Back
Top