Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inputbox Cancel Button - Not behaving

Status
Not open for further replies.

BatFace

Technical User
Oct 17, 2001
24
0
0
AU
I have the following code to find whatever is entered into the input box - move 11 columns right and enter "Y" in this cell;

Dim strFindText As String

strFindText = InputBox("type a number")
If strFindText <> &quot;&quot; Then Range(&quot;p1&quot;).Value = strFindText

With Sheets(&quot;sheet1&quot;).Range(&quot;d:d&quot;)
Set c = .find(strFindText, LookIn:=xlValues)
c.Offset(0, 11).Select
ActiveCell.FormulaR1C1 = &quot;Y&quot;

msg = &quot;Another Number?&quot;
ans = MsgBox(msg, vbYesNo)

Do Until ans = vbNo
strFindText = InputBox(&quot;type a number&quot;)
Set c = .find(strFindText, LookIn:=xlValues)

c.Offset(0, 11).Select
ActiveCell.FormulaR1C1 = &quot;Y&quot;

msg = &quot;Another Number?&quot;
ans = MsgBox(msg, vbYesNo)

Loop

End With

When cancel is pressed on the input box, a &quot;Y&quot; is put in cell o5 (only and always o5)...I thought the second line of code would stop it but it hasn't....I must need to add something else - but I'm only a newbie to vba and am not sure what?

Thanks in advance for your help

[bat]
 
Hi

Please refers to the MS Office forum, thread nos.

thread68-257429

rgrds
LSTAN
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top