PDA

View Full Version : Help - activate sheet



debauch
06-29-2007, 02:27 PM
Hello,

Im trying to activate a sheet within the workbook based on the cell 'G6'


Sheets(Sheets("control").Range("g6").Value).Activate


What am I doing wrong???

Example, if I have sheet names , yes, no , maybe, and the word maybe is in cell g6 , I would like the sheet 'maybe' to 'activate'

debauch
06-29-2007, 02:42 PM
Please help! Im on a deadline and this is the only line holding me back! I will PAY someone!!

david000
06-29-2007, 02:48 PM
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Me.Range("a1").Value = "maybe" Then
Sheet3.Activate
End If

End Sub

You can leave the sheet that contains the code, then return after some other code on the destination sheet later.

debauch
06-29-2007, 02:51 PM
?

The sheet names are already in place, lets say name 1 through 12, and its going between files. The data need to know which sheet to dump the data dynamically . So if I say 'sheet' maybe , the other 11 sheets are out of luck.

debauch
06-29-2007, 02:59 PM
Wait ... your right. It will work , I'll just need to specify the other 11 ... its messy, but I'll take it @!! Thank you.

david000
06-29-2007, 03:19 PM
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Me.Range("a1").Value = "Maybe" Then
Sheets("Maybe").Activate
ElseIf Me.Range("a1").Value = "No" Then
Sheets("No").Activate
ElseIf Me.Range("a1").Value = "Yes" Then
Sheets("Yes").Activate
End If
End Sub