Private sub Worksheet change question

G

Graeme

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
 
O

Otto Moehrbach

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
 
G

Graeme

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?
 
O

Otto Moehrbach

No. How that value gets into that cell makes no difference unless that cell
contains a formula and that formula generates that value. Otto
 
G

Graeme

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top