Why does this not work?
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then
If Target.Address = 1 Then
UserForm1.Show
Else
If Target.Address = 2 Then
UserForm2.Show
Else
End If
End Sub
Why does this not work?
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then
If Target.Address = 1 Then
UserForm1.Show
Else
If Target.Address = 2 Then
UserForm2.Show
Else
End If
End Sub
Your If statements are not structured correctly.
What are you actually tring to test for?
In your first If you are looking to see if the Target has the Address $A$1.
Then you are looking to see if the Address is 1 or 2.
A range address is not going to be 1 or 2, are you actually trying to test the value in cell A1?
![]()
Please Login or Register to view this content.
I am trying to limit code to triggering only when a certain cell is changed. When that cell is changed I want other cells to be affected by the code.
Well the code I posted should only be triggered when A1 is changed.
Obviously change that for your own needs.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks