VBA Range select problem


Posted by Ian Mac on November 16, 2001 6:35 AM

Can't get this to work,

I have a button which will goto a worksheet based on the value in a cell. That's fine

Private Sub CommandButton1_Click()

Sheets(Range("f5").Value).Activate

End Sub

The problem is I then wish to activate/select a particular cell so the user will be able to see the sheet from the begining. That cell being b1 (as a1 is hidden)

I just can't seem to get anything to do it for me

thanks

Ian Mac

Posted by NiuB on November 16, 2001 6:41 AM

Try this :

Private Sub CommandButton1_Click()

Sheets("YourSheetsName).select
Range("b1).select

End Sub

HTH

Posted by Ian Mac on November 16, 2001 7:43 AM

That's the first thing I tried...No joy, error at range().select line?? (NT)



Posted by Barrie Davidson on November 16, 2001 9:46 AM

Re: That's the first thing I tried...No joy, error at range().select line?? (NT)

You need to add closing quotation marks. Try

Private Sub CommandButton1_Click()

Sheets("YourSheetsName").Range("b1").Select

End Sub

Does this help?
Barrie

Barrie Davidson