Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 333
Default save textbox as number wth Cint?

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



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default save textbox as number wth Cint?

Sounds like you are typing letters into the textbox.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Karen53" wrote in message
...
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





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default save textbox as number wth Cint?

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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default save textbox as number wth Cint?

Karen,

If you use Val rather than using CInt, it won't error on that, and will
return 0.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Karen53" wrote in message
...
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





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 333
Default save textbox as number wth Cint?

Thank you, Bob. That sure makes things easier.

Why would I get an object defined error on this?

with ws
..Cells(Choice, 5).NumberFormat = "General"
end with

Thanks,



"Bob Phillips" wrote:

Karen,

If you use Val rather than using CInt, it won't error on that, and will
return 0.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Karen53" wrote in message
...
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




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default save textbox as number wth Cint?

The only thing that I can think is that Choice has not been set, and has the
value 0, thereby trying to reference cell E0, an invalid cell reference.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Karen53" wrote in message
...
Thank you, Bob. That sure makes things easier.

Why would I get an object defined error on this?

with ws
.Cells(Choice, 5).NumberFormat = "General"
end with

Thanks,



"Bob Phillips" wrote:

Karen,

If you use Val rather than using CInt, it won't error on that, and will
return 0.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"Karen53" wrote in message
...
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






  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 333
Default save textbox as number wth Cint?

Thank you, Bob. That is what it was.

"Bob Phillips" wrote:

The only thing that I can think is that Choice has not been set, and has the
value 0, thereby trying to reference cell E0, an invalid cell reference.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Karen53" wrote in message
...
Thank you, Bob. That sure makes things easier.

Why would I get an object defined error on this?

with ws
.Cells(Choice, 5).NumberFormat = "General"
end with

Thanks,



"Bob Phillips" wrote:

Karen,

If you use Val rather than using CInt, it won't error on that, and will
return 0.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"Karen53" wrote in message
...
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







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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Save Textbox into Named Range Karen53 Excel Programming 2 September 21st 07 03:00 AM
ListBox & TextBox Save Karen53 Excel Programming 2 September 19th 07 08:56 PM
How to tell textbox to treat number as number, not text, and notshow zero John Smith Excel Programming 1 November 16th 06 02:29 AM
Textbox & Save file problem Stuart[_5_] Excel Programming 0 August 4th 04 07:09 PM
Save TextBox Entry after WorkBook is closed wpllc2004 Excel Programming 1 April 12th 04 12:30 PM


All times are GMT +1. The time now is 08:50 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"