LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default If Then VBA

I am trying to get the following VBA IF Then script to run and am having
mixed results.

If a4 = No Then
MsgBox "No Match"
Exit Sub
Else
Supplier = InputBox("Modify Name or Code", "Company Update",
Range("F5:F5000").Find(TextBox1).Value)

Range("F5:F5000").Find(TextBox1).Value = Supplier
Range("V5:V5000").Find(TextBox1).Value = Supplier

End If

End Sub

Ideally, each time A4 = No, I want the the MsgBox to appear and the run to
stop; conversely each time cell A4=Ok, I want the script (lines below Else)
to execute. A4 represents a cell which determines if there is a match in
an underlying database column (i.e. returns No if not & OK if there is
in fact an exact match). Currently the first half of the script works, but,
does not execute beyond. If I remove the Exit Sub I have a Run Time
Error. Ive tried several iterations and feel I am close, yet have not got
the end result. Could you assist me please!
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 08:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright 2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"