Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 124
Default add numbers in textboxes on userform

Hi!

I have textbox1, textbox2, textbox3, textbox4, and textbox5 on a userform.
I'm trying to add textbox1, textbox2, textbox3, and textbox4 and place the
sum (total) in Textbox5.
I've tried the following code attached to a command button:
me.textbox 5= (textbox1 + textbox2+ textbox3 + textbox4)

I keep getting the error message that textbox4 member or data cannot be
found. I've double check the spelling of the names and they are correct. If
I remove Textbox4 from the code, then the error states it cannot find
textbox3 member or data.

What am I doing wrong??

Thanks in advance for your help!!!

Kimberly


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 550
Default add numbers in textboxes on userform

Kimberly,

What's in the textboxes is a string.
You have to convert them to numbers before adding them.

e.g.
me.textbox5= cDbl(textbox1) + cDbl(textbox2)
etc.

John

KimberlyC wrote:

Hi!

I have textbox1, textbox2, textbox3, textbox4, and textbox5 on a userform.
I'm trying to add textbox1, textbox2, textbox3, and textbox4 and place the
sum (total) in Textbox5.
I've tried the following code attached to a command button:
me.textbox 5= (textbox1 + textbox2+ textbox3 + textbox4)

I keep getting the error message that textbox4 member or data cannot be
found. I've double check the spelling of the names and they are correct. If
I remove Textbox4 from the code, then the error states it cannot find
textbox3 member or data.

What am I doing wrong??

Thanks in advance for your help!!!

Kimberly


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 124
Default add numbers in textboxes on userform

Hi
Thanks!
I tried it and I'm still getting the same error messages.
Is there anything else that could casue these errors?

Thanks again!!

"John Wilson" wrote in message
...
Kimberly,

What's in the textboxes is a string.
You have to convert them to numbers before adding them.

e.g.
me.textbox5= cDbl(textbox1) + cDbl(textbox2)
etc.

John

KimberlyC wrote:

Hi!

I have textbox1, textbox2, textbox3, textbox4, and textbox5 on a

userform.
I'm trying to add textbox1, textbox2, textbox3, and textbox4 and place

the
sum (total) in Textbox5.
I've tried the following code attached to a command button:
me.textbox 5= (textbox1 + textbox2+ textbox3 + textbox4)

I keep getting the error message that textbox4 member or data cannot be
found. I've double check the spelling of the names and they are correct.

If
I remove Textbox4 from the code, then the error states it cannot find
textbox3 member or data.

What am I doing wrong??

Thanks in advance for your help!!!

Kimberly




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 550
Default add numbers in textboxes on userform

Kimberly,

If the textboxes do exist, they should be listed in the dropdown
in the VBA Editor.
If they don't, try to compile the project and save, close, reopen
the workbook.


John

"KimberlyC" wrote in message
...
Hi
Thanks!
I tried it and I'm still getting the same error messages.
Is there anything else that could casue these errors?

Thanks again!!

"John Wilson" wrote in message
...
Kimberly,

What's in the textboxes is a string.
You have to convert them to numbers before adding them.

e.g.
me.textbox5= cDbl(textbox1) + cDbl(textbox2)
etc.

John

KimberlyC wrote:

Hi!

I have textbox1, textbox2, textbox3, textbox4, and textbox5 on a

userform.
I'm trying to add textbox1, textbox2, textbox3, and textbox4 and

place
the
sum (total) in Textbox5.
I've tried the following code attached to a command button:
me.textbox 5= (textbox1 + textbox2+ textbox3 + textbox4)

I keep getting the error message that textbox4 member or data cannot

be
found. I've double check the spelling of the names and they are

correct.
If
I remove Textbox4 from the code, then the error states it cannot find
textbox3 member or data.

What am I doing wrong??

Thanks in advance for your help!!!

Kimberly






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 124
Default add numbers in textboxes on userform

Thanks John
I just needed to close and reopen. It's working now.
Thanks again!
"John Wilson" wrote in message
...
Kimberly,

If the textboxes do exist, they should be listed in the dropdown
in the VBA Editor.
If they don't, try to compile the project and save, close, reopen
the workbook.


John

"KimberlyC" wrote in message
...
Hi
Thanks!
I tried it and I'm still getting the same error messages.
Is there anything else that could casue these errors?

Thanks again!!

"John Wilson" wrote in message
...
Kimberly,

What's in the textboxes is a string.
You have to convert them to numbers before adding them.

e.g.
me.textbox5= cDbl(textbox1) + cDbl(textbox2)
etc.

John

KimberlyC wrote:

Hi!

I have textbox1, textbox2, textbox3, textbox4, and textbox5 on a

userform.
I'm trying to add textbox1, textbox2, textbox3, and textbox4 and

place
the
sum (total) in Textbox5.
I've tried the following code attached to a command button:
me.textbox 5= (textbox1 + textbox2+ textbox3 + textbox4)

I keep getting the error message that textbox4 member or data cannot

be
found. I've double check the spelling of the names and they are

correct.
If
I remove Textbox4 from the code, then the error states it cannot

find
textbox3 member or data.

What am I doing wrong??

Thanks in advance for your help!!!

Kimberly









  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 550
Default add numbers in textboxes on userform

Kimberly,

I just needed to close and reopen. It's working now.

I'm glad that solved your problem, but..........
When you add a textbox (or other control) to a UserForm
it should "automatically" be included in your "project" without
having to close and reopen.
Sometimes this doesn't happen and I can't give you an answer
as to why. I've asked why in the ng's and can't really get
a definitive answer myself, but it does happen.
Anyway.....since this did occur in the particular workbook
that you're using, if you haven't already done so, do yourself
a favor and dowload Rob Bovey's "Code Cleaner".
http://www.appspro.com/
and use it religiously (at least on this workbook).

John


"KimberlyC" wrote in message
...
Thanks John
I just needed to close and reopen. It's working now.
Thanks again!
"John Wilson" wrote in message
...
Kimberly,

If the textboxes do exist, they should be listed in the dropdown
in the VBA Editor.
If they don't, try to compile the project and save, close, reopen
the workbook.


John

"KimberlyC" wrote in message
...
Hi
Thanks!
I tried it and I'm still getting the same error messages.
Is there anything else that could casue these errors?

Thanks again!!

"John Wilson" wrote in message
...
Kimberly,

What's in the textboxes is a string.
You have to convert them to numbers before adding them.

e.g.
me.textbox5= cDbl(textbox1) + cDbl(textbox2)
etc.

John

KimberlyC wrote:

Hi!

I have textbox1, textbox2, textbox3, textbox4, and textbox5 on a
userform.
I'm trying to add textbox1, textbox2, textbox3, and textbox4 and

place
the
sum (total) in Textbox5.
I've tried the following code attached to a command button:
me.textbox 5= (textbox1 + textbox2+ textbox3 + textbox4)

I keep getting the error message that textbox4 member or data

cannot
be
found. I've double check the spelling of the names and they are

correct.
If
I remove Textbox4 from the code, then the error states it cannot

find
textbox3 member or data.

What am I doing wrong??

Thanks in advance for your help!!!

Kimberly









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
UserForm TextBoxes - Is there a way to format as currency or perce Terry Excel Discussion (Misc queries) 0 September 11th 08 06:27 PM
Send and Receive Data From Web Site Into UserForm TextBoxes Minitman Excel Discussion (Misc queries) 0 August 4th 08 05:33 PM
Textboxes SAL Excel Discussion (Misc queries) 2 July 13th 07 12:24 AM
Need help w/ userform with 12 textboxes with data going into colum cj2k2k Excel Discussion (Misc queries) 1 June 13th 07 02:38 PM
UserForm TextBoxes Rob Excel Discussion (Misc queries) 2 August 6th 05 03:07 AM


All times are GMT +1. The time now is 04:07 AM.

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"