Thread: VBmodeless
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff Harald Staff is offline
external usenet poster
 
Posts: 1,327
Default VBmodeless

Hi Jeff

Try

Sub test()
Dim increase As Single
Dim S As String
S = InputBox("Enter amount of % increase:")
If S = "" Then
MsgBox "Chicken"
Exit Sub
End If
If Val(S) = 0 Then Exit Sub
increase = CSng(S)
MsgBox "Increase by " & S

End Sub

HTH. Best wishes Harald

"jeffP" skrev i melding
...
Hi,
thanks for any and all help.
Code follows
jeffP

Sub Revincrease()
Dim increase As Single
Dim L As Integer
'var increase set as single so it can be used for
'multiplication in formula . No?
'but it causes runtime error 13 'type mismatch' if cancel
button
'clicked Also same error if alpha characters entered
inputbox

'On Error Resume Next
'rem ed out On Error because it will change amount in
column c
' multiplies d x 0 making it =d and definitely not want I
want
'user to get when clicking "cancel"
increase = InputBox("Enter amount of % increase")
'calulates colunm c to be amount of column D plus _
' an increase by a % the user inputs

For L = 2 To 30
Range("c" & L).Value = Range("d" & L).Value _
+ Range("d" & L) * increase
Next
End Sub



-----Original Message-----
Hi

Inputboxes or textboxes doesn't return integers, they

return strings, and ""
both for Cancel and for nothing written. Please post your

code (or the
relevant part if it's huge) for suggestions.

Best wishes Harald

"jeffP" skrev i melding
...
CAn someone tell me where to read what this is? VBHelp

says nothing.

Second queston I'm returning a value (integer) from a

input box and
getting error mismatch types when clicking Cancel (or

escape).
I read here how ot check against the "" that Cancel

returns but I can't
because of teh mismatch.
I'd also like to validate the input (no text, two

digits, no decimal
point) data but do'nt know how .
THanks in advance for any help you can give.
jeffP



.