KP_SoCal
Board Regular
- Joined
- Nov 17, 2009
- Messages
- 116
Below is a code that most of you experts will realize right away that it will crash my excel document as soon as I run it.
In each of my sheet names that begin with "Series" I have a data validation combo box embedded in the cell. Each time I select a certain value, I use the "SheetChange" event to bring me to the appropriate sheet.
The part that starts giving me problems is this. Lets say I select "Widget4" in my dropdown list for Sheet name "Series1". I not only want to go to "Series4" sheet, but want the value in cell A6 to reflect "Widget4" as a value instead of "Widget1", which is the default value.
I tried doing setting this value in the "Sheet Activation" event (see code below), but as you can guess, the two events are in total conflict with one another.
If any of you experts have a solution to this dilemma, I would be most grateful. Thanks!
In each of my sheet names that begin with "Series" I have a data validation combo box embedded in the cell. Each time I select a certain value, I use the "SheetChange" event to bring me to the appropriate sheet.
The part that starts giving me problems is this. Lets say I select "Widget4" in my dropdown list for Sheet name "Series1". I not only want to go to "Series4" sheet, but want the value in cell A6 to reflect "Widget4" as a value instead of "Widget1", which is the default value.
Code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If ActiveSheet.Name Like "Series*" Then
If Not Intersect(Target, Range("A6")) Is Nothing Then
Select Case Range("C5")
Case "1"
Sheets("Series1").Select
Range("A6") = Range("B8")
Case "4"
Sheets("Series4").Select
Range("A6") = Range("B8")
Case Else
MsgBox "Something weird is going on...", vbCritical, "Uuh-oohh"
End Select
End If
End If
End Sub
If any of you experts have a solution to this dilemma, I would be most grateful. Thanks!
Code:
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
For Each wsSheet In Worksheets
If wsSheet.Name Like "Series*" Then
With wsSheet.Range("A6")
.Value = wsSheet.Range("A5")
End With
End If
Next wsSheet
End Sub