View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default IF THEN ELSE in VBA

Sub FieldTip()
If ActiveCell.Address = "$M$3" Then
Range("S8").Value = Range("K57").Value
ElseIf ActiveCell.Addess = "$M$5") Then
Range("S8").Value = Range("K58").Value
Else
Range("S8").Value = " "
End If
End Sub

How many cells does "so on" refer to?



--
Regards,
Tom Ogilvy


"CCManager " wrote in message
...
What I am trying to do:
If the user has cell M3 selected, then change cell S8 to show the data
in cell K57. If the user has cell M5 selected, change cell S8 to show
the data in cell K58...and so on.

Here is what I have that is not working.

Sub FieldTip()
If ActiveCell.Value = ("M3") Then Range("S8").Value = ("K57")
Else: If ActiveCell.Value = ("M5") Then Range("S8").Value = ("K58")
Else: Range("S8").Value = " "
End If
End Sub

Any help would be greatly appreciated.


---
Message posted from http://www.ExcelForum.com/