Positioning Worksheet names on Activate

J

JimMay

The below code allows me to switch
Worksheets with ease (tks to Tom Ogilvy); One last thing I'd like to be
able to do (with my 100 sheets) is have the selected sheet Appear in
position one (scrolled to the First position in the view). Meaning if
Before reselecting from my cb my w/s's shown (below) might be A20, A21,
A22, A23, A24.... (then from The Combobox) I select sheet A60 - as a
result A01 thru A59 are placed out-of-sight to the left and I see in the
first position A60, A61, A62, A64.....
Can this be done?
If so, with what code?
TIA,




Private Sub ComboBox1_Change()
Myws = ComboBox1.Value
Worksheets(Myws).Activate
AppActivate Application.Caption
End Sub
 
N

Norman Jones

Hi Jim,

Try:

'=============>>
Private Sub ComboBox1_Change()
Dim MyWs As String

MyWs = ComboBox1.Value
With Worksheets(MyWs)
.Move Before:=Sheets(1)
.Activate
End With
AppActivate Application.Caption

End Sub
'<<=============
 
J

JimMay

Fantastic!!
Tks Norman,
Jim

Hi Jim,

Try:

'=============>>
Private Sub ComboBox1_Change()
Dim MyWs As String

MyWs = ComboBox1.Value
With Worksheets(MyWs)
.Move Before:=Sheets(1)
.Activate
End With
AppActivate Application.Caption

End Sub
'<<=============
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top