#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default VBmodeless

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



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBmodeless

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



.

  #3   Report Post  
Posted to microsoft.public.excel.programming
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



.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default VBmodeless

Harold,
That did the trick. I didn't know VAL or CSNG (I do know)
Thanks.
Somebody else suggested If StrPtr(S) = 0 Then
I've never heard of StrPtr either and hellp returns no
subject found. Can you 'splain or send me where I can find
this?
jeffp
-----Original Message-----
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
news:2439D0C5-E8E5-430B-A355-

...
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


.



.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default VBmodeless

Hi Jeff,

Look at this on Karl E. Peterson's site:

http://www.mvps.org/vb/index2.html?tips/varptr.htm



---
Regards,
Norman.


"jeffP" wrote in message
...
Harold,
That did the trick. I didn't know VAL or CSNG (I do know)
Thanks.
Somebody else suggested If StrPtr(S) = 0 Then
I've never heard of StrPtr either and hellp returns no
subject found. Can you 'splain or send me where I can find
this?
jeffp
-----Original Message-----
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
news:2439D0C5-E8E5-430B-A355-

...
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


.



.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default VBmodeless

strPtr has no role here that I see. What was suggested specifically? I
don't see any suggestion like that in this thread.

for information:

http://support.microsoft.com/default...24&Product=vbb
HOWTO: Get the Address of Variables in Visual Basic



--
Regards,
Tom Ogilvy

"jeffP" wrote in message
...
Harold,
That did the trick. I didn't know VAL or CSNG (I do know)
Thanks.
Somebody else suggested If StrPtr(S) = 0 Then
I've never heard of StrPtr either and hellp returns no
subject found. Can you 'splain or send me where I can find
this?
jeffp
-----Original Message-----
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
news:2439D0C5-E8E5-430B-A355-

...
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


.



.



Reply
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 07:22 PM.

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

About Us

"It's about Microsoft Excel"