![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Apr 2002
Posts: 12
|
Okey, here is the deal:
I have made a Userform that includes 3 text boxes that a user would input info into (the userform has "OK" & "Cancel" buttons as well). When the "OK" button is clicked, the code will insert a new row (lets say row A) and input the info from the text boxes in the cells (A1, A2, A3). What command would I use to take the info (that that the user inputted into the text boxes) and place them into the new A1, A2 & A3 cells? ------------------------ I have programed the Userform to insert that new row as soon as the button that activates the userform is press, but I don't think that I would like keep it like this - because the cancel button doesn't undo the insert . . . -Thanks!!! Samanathon |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
Something like this...
Sheet1.Range("A1") = TextBox1.Text Tom |
|
|
|
|
|
#3 |
|
New Member
Join Date: Apr 2002
Posts: 12
|
Thanks for the reply Tom!
I am still having a bit of trouble with this text box . . . I tried "Sheet1.Range("A1") = TextBox1.Text" but still couldn't get it to work ------------------------------- Some more info: 1. User clicks a button that activates a user form 2. Userform has three text boxes 3. After entering info, user clicks "OK" 4. Info is inputted into cells 5. Userform hides ---------------------------------- ^^ I am having trouble with #4 of this example. Thanks for all of your help! |
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Feb 2002
Location: Where the wild roses grow
Posts: 285
|
Try this:
worksheets("sheet1").range("a1").value=textbox1 Audiojoe |
|
|
|
|
|
#5 | |
|
New Member
Join Date: Apr 2002
Location: Lawrence, KS
Posts: 29
|
Quote:
|
|
|
|
|
|
|
#6 |
|
New Member
Join Date: Apr 2002
Posts: 12
|
^^ I know, that's just how I have it right now - I've never really played around with Userforms until now. I will change it though.
-Thanks! |
|
|
|
|
|
#7 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
What is the current code that you are using
with the cmd button. What is the sheet name you are tarnsfering to. |
|
|
|
|
|
#8 |
|
New Member
Join Date: Apr 2002
Posts: 12
|
The sheet name is the defult "Sheet 1", and here is the current code:
![]() Private Sub Cancel_Click() Message = "Do you really want to back out " _ & "be a wimp?" 'This will ask the user to confirm that they ' wish to close the Userform. If MsgBox(Message, vbYesNo) = vbYes Then Hide 'If they click "Yes", then it will close! End If 'If they click "No", the comfirmation box closes. End Sub ------------------------------------------- Private Sub Input_Date_Change() End Sub ------------------------------------------- Private Sub Input_DRO_Number_Change() End Sub ------------------------------------------- Private Sub Input_Show_Name_Change() End Sub ------------------------------------------- Private Sub Input_Show_Click() ' Insert_A_Row_A6 Macro ' Macro recorded 4/23/2002 by Saman Sadeghi ' Rows("6:6").Select Selection.Insert Shift:=xlDown 'This will insert a new row at cell A6 End Sub |
|
|
|
|
|
#9 |
|
New Member
Join Date: Apr 2002
Posts: 12
|
Anyone?
|
|
|
|
|
|
#10 |
|
Legend
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
|
Lemme see, try to break it down to the nitty gritty. Go into the Visual basic editor. Go into your userform module (not a normal module, in the project expolorer, this module is located in the "forms" folder, expand the contents of this folder), it's probably "userform1", you can browse modules with the project explorer. Figure out the name of your "OK" button and the name of your "Textbox", you can find out/verify by right-clicking on these items in the vbe and select properties. Right click on your form and place the following:
Code:
Private Sub CommandButton1_Click() Sheet1.[a1] = TextBox1.Text End Sub _________________ Cheers, NateO [ This Message was edited by: NateO on 2002-04-26 15:26 ] |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|