Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 709
Default Help with UserForm code.

I have TextBox1, CommandButton1 and CommandButton2. When user inputs a number
in TextBox1 and then clicks CommandButton1, I need that number sent to
"Sheet4" Cell "B2" and a msgbox stating that "Whatever number was entered had
been added to your Vacation". If CommandButton2 is selected UserForm closes.
I understand I'm asking a lot! Thanks in advance for any help!!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Help with UserForm code.

Private Sub CommandButton1_Click()
Worksheets("Sheet4").Range("B2").Value = cdbl(Textbox1.Text)
msgbox Textbox1.Text & " was added to your vacation"
End sub

Private Sub CommandButton2_Click()
Unload Me
End Sub


if you want to add the number in the textbox to any value alreadyi n B2 it
would be
Private Sub CommandButton1_Click()
With Worksheets("Sheet4")
.Range("B2").Value = .Range("B2").Value + cdbl(Textbox1.Text)
End With
msgbox Textbox1.Text & " was added to your vacation"
End sub


If the number will be an integer, you can replace cdbl with clng
--
Regards,
Topm Ogilvy


"Richard" wrote in message
...
I have TextBox1, CommandButton1 and CommandButton2. When user inputs a

number
in TextBox1 and then clicks CommandButton1, I need that number sent to
"Sheet4" Cell "B2" and a msgbox stating that "Whatever number was entered

had
been added to your Vacation". If CommandButton2 is selected UserForm

closes.
I understand I'm asking a lot! Thanks in advance for any help!!



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
Help with UserForm Code sneagle Excel Programming 1 November 18th 05 06:41 PM
Creating a Userform using code trini Excel Programming 1 March 5th 05 11:15 PM
Userform Code scrabtree23[_3_] Excel Programming 3 December 5th 04 05:05 AM
UserForm code help needed. madbloke[_11_] Excel Programming 1 September 23rd 04 01:08 PM
VBA code for Userform Martin Los Excel Programming 4 December 5th 03 03:04 PM


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

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

About Us

"It's about Microsoft Excel"