View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Cush Cush is offline
external usenet poster
 
Posts: 126
Default Problem with Subs and If's !


In addition to the other responses, here is a detail that should help you:

When you use the code line
Selection.Range("B1") ...................

if you have selected, say, D10:X20, then "B1" is not the cell "B1" but it is
the top row and 2nd col WITHIN your SELECTION. ie CELL E10
Likewise Selection.Range("C3") is actually cell G13 - the 3rd row, 3rd col
of you SELECTION.



"Tachyon" wrote:

Hi - Ok, I'm a real newbie so this will be easy for someone :-)

I can't figure why this code loops around in strange ways and doesn't just
step through doing the If's and Then's etc. I'll say no more at this stage
because it's probably embarassingly blindingly obvious to everyone else!

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Value = "GD" Then
Selection.Range("B1").Value = ("Graeme John Dixon")
Else
Selection.Range("B1").Value = ("I don't know you")
End If
If Range("B5").Value = ("Graeme John Dixon") Then
Range("A1") = ("Test")
End If
End Sub

--
Tachyon