Thread: InputBox Help
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Conan Kelly Conan Kelly is offline
external usenet poster
 
Posts: 419
Default InputBox Help

cottage6,

I would assign the results of the input box to a stirng variable, then test
the string variable:



Sub InputIncTon()
dim pstrResponse as string

Sheets("Credits").Select
Range("G4").Select

pstrResponse = InputBox("What is the INC/TON?", "INC/TON")
If pstrResponse = "" Then
exit sub
else
activecell = pstrResponse
end if

With Worksheets("Credits")
.Range("G4:G600").FillDown
End With

End Sub




Then there is no need for "GetMeOuttaHere"

HTH,

Conan






"cottage6" wrote in message
...
Hi All,
I'm sure this is an easy question for most, except for me! I have an
InputBox that gets a value and then copies the number down. Numbers will
already be in the
column from the prior week, and could be used again. However, if the user
invokes the macro by mistake and then clicks "Cancel" the first entry gets
wiped out. I'm pretty sure I could get around this, but I really want the
correct way of doing this. Enclosed is my ratty code; help would be much
appreciated!

Sub InputIncTon()
Sheets("Credits").Select
Range("G4").Select

ActiveCell = InputBox("What is the INC/TON?", "INC/TON")
If ActiveCell = "" Then GoTo GetMeOuttaHere

With Worksheets("Credits")
.Range("G4:G600").FillDown
End With

GetMeOuttaHe

End Sub