Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to use a Private Sub Worksheet_Change event macro to change the
value of cell g12 when theres a change to cell a3, and when cell g6 = 1. Cell a3 is itself the cell link of a combo box (created from the Forms toolbar). I know that this kind of macro only works under some circumstances, but is this one of them? My code is: Private Sub worksheet_change(ByVal target As Range) If Not Intersect(target, Me.Range("a3")) Is Nothing Then If Range("g6").Value = "1" Then Range("g12").Value = "8" End If End If End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I removed the quotes around the 1 and the 8 and it works for me. HTH Otto
Private Sub Worksheet_Change(ByVal Target As Range) If Not Intersect(Target, Me.Range("a3")) Is Nothing Then If Range("g6").Value = 1 Then Range("g12").Value = 8 End If End If End Sub "Graeme" wrote in message ... I am trying to use a Private Sub Worksheet_Change event macro to change the value of cell "g12" when there's a change to cell "a3", and when cell "g6" = 1. Cell "a3" is itself the cell link of a combo box (created from the "Forms" toolbar). I know that this kind of macro only works under some circumstances, but is this one of them? My code is: Private Sub worksheet_change(ByVal target As Range) If Not Intersect(target, Me.Range("a3")) Is Nothing Then If Range("g6").Value = "1" Then Range("g12").Value = "8" End If End If End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for the quick response, however it's still not working on my end. In
your file, is the value of "a3" changing when a combo box selection changes? "Otto Moehrbach" wrote: I removed the quotes around the 1 and the 8 and it works for me. HTH Otto Private Sub Worksheet_Change(ByVal Target As Range) If Not Intersect(Target, Me.Range("a3")) Is Nothing Then If Range("g6").Value = 1 Then Range("g12").Value = 8 End If End If End Sub "Graeme" wrote in message ... I am trying to use a Private Sub Worksheet_Change event macro to change the value of cell "g12" when there's a change to cell "a3", and when cell "g6" = 1. Cell "a3" is itself the cell link of a combo box (created from the "Forms" toolbar). I know that this kind of macro only works under some circumstances, but is this one of them? My code is: Private Sub worksheet_change(ByVal target As Range) If Not Intersect(target, Me.Range("a3")) Is Nothing Then If Range("g6").Value = "1" Then Range("g12").Value = "8" End If End If End Sub |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
No. How that value gets into that cell makes no difference unless that cell
contains a formula and that formula generates that value. Otto "Graeme" wrote in message ... Thanks for the quick response, however it's still not working on my end. In your file, is the value of "a3" changing when a combo box selection changes? "Otto Moehrbach" wrote: I removed the quotes around the 1 and the 8 and it works for me. HTH Otto Private Sub Worksheet_Change(ByVal Target As Range) If Not Intersect(Target, Me.Range("a3")) Is Nothing Then If Range("g6").Value = 1 Then Range("g12").Value = 8 End If End If End Sub "Graeme" wrote in message ... I am trying to use a Private Sub Worksheet_Change event macro to change the value of cell "g12" when there's a change to cell "a3", and when cell "g6" = 1. Cell "a3" is itself the cell link of a combo box (created from the "Forms" toolbar). I know that this kind of macro only works under some circumstances, but is this one of them? My code is: Private Sub worksheet_change(ByVal target As Range) If Not Intersect(target, Me.Range("a3")) Is Nothing Then If Range("g6").Value = "1" Then Range("g12").Value = "8" End If End If End Sub |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
That is how I thought it worked, and when I manually type in a value in cell
"a3", the macro works. However, when the value in "a3" gets changed after I make a new selection in the associated drop-down box, it does not work. This is the part that is confusing me. "Otto Moehrbach" wrote: No. How that value gets into that cell makes no difference unless that cell contains a formula and that formula generates that value. Otto "Graeme" wrote in message ... Thanks for the quick response, however it's still not working on my end. In your file, is the value of "a3" changing when a combo box selection changes? "Otto Moehrbach" wrote: I removed the quotes around the 1 and the 8 and it works for me. HTH Otto Private Sub Worksheet_Change(ByVal Target As Range) If Not Intersect(Target, Me.Range("a3")) Is Nothing Then If Range("g6").Value = 1 Then Range("g12").Value = 8 End If End If End Sub "Graeme" wrote in message ... I am trying to use a Private Sub Worksheet_Change event macro to change the value of cell "g12" when there's a change to cell "a3", and when cell "g6" = 1. Cell "a3" is itself the cell link of a combo box (created from the "Forms" toolbar). I know that this kind of macro only works under some circumstances, but is this one of them? My code is: Private Sub worksheet_change(ByVal target As Range) If Not Intersect(target, Me.Range("a3")) Is Nothing Then If Range("g6").Value = "1" Then Range("g12").Value = "8" End If End If End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Special Private Character Question | Excel Discussion (Misc queries) | |||
Question about private subs | Excel Programming | |||
Private Textbox Exit Sub question... | Excel Worksheet Functions | |||
Private Function Code Change | Excel Programming | |||
Private Sub Workbook Open() - question | Excel Programming |