![]() |
Private sub Worksheet change question
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 |
Private sub Worksheet change question
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 |
Private sub Worksheet change question
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 |
Private sub Worksheet change question
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 |
Private sub Worksheet change question
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 |
All times are GMT +1. The time now is 08:10 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com