Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA forms in excel
I use forms for data input in excel. I have a for named test. I have 10
fields on the form named t1 thru t10. Currently when I open the form I get data from a sheet and put it in the field names using: test.t1.value=sheetname.range("H8"). using this method I have to create 10 lines of code to populate the ten fields. How can I use a for next loop to change the field name in test.t1.value while stepping through the loop ie; t1, t2, t3 ect. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA forms in excel
You didn't share how you loop through the cells. So I used A1 to A3 in my
tests. You'll have to change the name of the textbox, too. Option Explicit Private Sub UserForm_Initialize() Dim iCtr As Long For iCtr = 1 To 3 '10 for you Me.Controls("textbox" & iCtr).Value _ = ActiveSheet.Cells(iCtr, "A").Text Next iCtr End Sub tcassio wrote: I use forms for data input in excel. I have a for named test. I have 10 fields on the form named t1 thru t10. Currently when I open the form I get data from a sheet and put it in the field names using: test.t1.value=sheetname.range("H8"). using this method I have to create 10 lines of code to populate the ten fields. How can I use a for next loop to change the field name in test.t1.value while stepping through the loop ie; t1, t2, t3 ect. -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA forms in excel
By Field, do you mean Text Box, Label, List Box, ComboBox ? Not familiar
with what a field is. "tcassio" wrote in message ... I use forms for data input in excel. I have a for named test. I have 10 fields on the form named t1 thru t10. Currently when I open the form I get data from a sheet and put it in the field names using: test.t1.value=sheetname.range("H8"). using this method I have to create 10 lines of code to populate the ten fields. How can I use a for next loop to change the field name in test.t1.value while stepping through the loop ie; t1, t2, t3 ect. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Forms in Excel | Excel Discussion (Misc queries) | |||
forms in Excel | Excel Discussion (Misc queries) | |||
Excel forms - authorise / deny forms | Excel Programming | |||
RefEdits and normal forms / forms in a DLL | Excel Programming | |||
Calling Forms from Forms - Exit problems | Excel Programming |