View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Input Box Cancel function

Something like this maybe...

Dim Answer As String
Answer = InputBox("ENTER YOUR NAME")
If Len(Answer) = 0 Then
Rows(4).Delete
Exit Sub
End If
Range("B4").Value = Answer
Answer = InputBox("ENTER THE DATE YOU NEED THE FILE BY")
If Len(Answer) = 0 Then
Rows(4).Delete
Exit Sub
End If
Range("C4") = Answer
Range("B4").Select
'
' Rest of your code goes here
'

NOTE: Test the code out on a copy of your data as you cannot Undo changes
made my macro code (I'm thinking about the Row 4 delete when I say that)

--
Rick (MVP - Excel)


"Munchkin" wrote in message
...
My input box works great when a user is filling in the info. But I also
want
to give them the option to press cancel if they made a mistake & don't
want
to proceed. If they press cancel I want Row 4 to be deleted & the macro
to
end. How to I do that?


Range("B4") = InputBox("ENTER YOUR NAME - Press 'Enter' when done")
Range("C4") = InputBox("ENTER THE DATE YOU NEED THE FILE BY - Press
'Enter' when done")

Range("B4").Select