View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Karen53 Karen53 is offline
external usenet poster
 
Posts: 333
Default save textbox as number wth Cint?

Thanks to both of you. I realized it was because the textbox was empty. So
I'm checking for that as well as the numeric value.

Thanks,
Karen



"Dave Peterson" wrote:

Maybe you could check first:

with ws
with .Cells(Choice, 7)
.NumberFormat = "0"
if isnumeric(me.txtdaysoccupied.value) then
.value = CInt(Me.txtDaysOccupied.Value)
else
.value = 0 'or a warning message???
end if
end with
end with



end with

Karen53 wrote:

Hi,

I am having trouble saving my textbox as a number. Here is the format I am
using..

with ws
.Cells(Choice, 7).NumberFormat = "0"
.Cells(Choice, 7) = CInt(Me.txtDaysOccupied.Value)
end with

It errors out at the CInt statement with a Type Mismatch. I tried declaring
an integer variable and converting to this as well but I received the same
error message.

What am I missing?

Thanks


--

Dave Peterson