![]() |
![]() |
|
|||||||
| 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
Location: East Texas
Posts: 38
|
I have a userform with 3 text boxes. When the user clicks the command button it places the contents of the textboxes on sheet 1 (row 1 column B). What is happening is that each time the commandbutton is clicked it replaces the text already on sheet one. I need a code that will look for the last row and last column that has data and place the contents in the next empty cell and column.
Thanks in Advance |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Mar 2002
Location: =ActiveCell.Address
Posts: 478
|
Hiya,
Could you adapt something like the following for your purposes... Say you're filling in Column A Sub FillDataFromTextbox Dim Lastrow As Integer Lastrow = Range("A65536").End(xlUp).Row Range("A" & Lastrow + 1).Value = Userform1.Textbox1.Value End Sub Rgds AJ |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Location: Where the wild roses grow
Posts: 285
|
I have something very similar to this. I put this code into my command button:
Columns("B:B").Insert Shift:=xlToRight Range("A1").Select I have code in each of my textboxes along the lines of: Worksheets("sheet1").range("b1").value=textbox1 so that as soon as your answer goes into textbox1, it appears on your sheet. When you click the command button at the end, it inserts a row, shifting your answers to column C, archiving them |
|
|
|
|
|
#4 |
|
New Member
Join Date: Apr 2002
Location: East Texas
Posts: 38
|
Thanks AJ, just what the Dr. ordered
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|