View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
ben ben is offline
external usenet poster
 
Posts: 232
Default Cell change event

gig,
what error message are you recieving?

"gig" wrote:

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