View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
gig gig is offline
external usenet poster
 
Posts: 9
Default Cell change event

I keep getting an error message when range("attn") is changed. If I
delete the vlookup formula line and put something like msgbox "hello"
it will work fine. But what puzzles me is that the same vlookup line
formula works in another program with no problems. Can anyone tell me
what I'm doing wrong?

Thanks,
Greg


Private Sub Worksheet_Change(ByVal Target As Excel.Range)

Dim company As Range
Dim database As Range
Dim attn As Range

If Target.Address = Range("attn").Address Then

Range("company") = Application.WorksheetFunction.VLookup(Range("attn" ),
Range("database"), 2, False)
End If

End Sub