Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy test to form
What is the best way to copy data from a row, lets say row 2 cells 1 thru 15
to 15 text boxes on a form? txt1= activeRow column 1 txt2=activeRow column 2 txt3 = active row column 3 You get the idea: Most of the data is Text, but there are a few dates in the cells |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy test to form
one way:
For i= 1 to 15 me.controls("txt" & i).value=Cells(activerow,i) next i if text boxes are TXT1 to TXT15 HTH "SMERTZ" wrote: What is the best way to copy data from a row, lets say row 2 cells 1 thru 15 to 15 text boxes on a form? txt1= activeRow column 1 txt2=activeRow column 2 txt3 = active row column 3 You get the idea: Most of the data is Text, but there are a few dates in the cells |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy test to form
Private Sub UserForm_Initialize()
Dim myCtrl As Control For Each myCtrl In Me.Controls If Left(myCtrl.Name, 3) = "txt" Then myCtrl.Value = Cells(2, Val(Mid(myCtrl.Name, 4))).Value Next End Sub "SMERTZ" wrote: What is the best way to copy data from a row, lets say row 2 cells 1 thru 15 to 15 text boxes on a form? txt1= activeRow column 1 txt2=activeRow column 2 txt3 = active row column 3 You get the idea: Most of the data is Text, but there are a few dates in the cells |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy test to form
OK, what if the test boxes actually have names?
I could rename them I guess. "Toppers" wrote in message ... one way: For i= 1 to 15 me.controls("txt" & i).value=Cells(activerow,i) next i if text boxes are TXT1 to TXT15 HTH "SMERTZ" wrote: What is the best way to copy data from a row, lets say row 2 cells 1 thru 15 to 15 text boxes on a form? txt1= activeRow column 1 txt2=activeRow column 2 txt3 = active row column 3 You get the idea: Most of the data is Text, but there are a few dates in the cells |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy test to form
If they have names without a constant prefix e.g TXT...., then have any array
of text box names and compare with "control names". nth element in array corresponds to nth column . You could use MATCH function to compare. "SMERTZ" wrote: OK, what if the test boxes actually have names? I could rename them I guess. "Toppers" wrote in message ... one way: For i= 1 to 15 me.controls("txt" & i).value=Cells(activerow,i) next i if text boxes are TXT1 to TXT15 HTH "SMERTZ" wrote: What is the best way to copy data from a row, lets say row 2 cells 1 thru 15 to 15 text boxes on a form? txt1= activeRow column 1 txt2=activeRow column 2 txt3 = active row column 3 You get the idea: Most of the data is Text, but there are a few dates in the cells |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Copy from form to worksheet | Excel Discussion (Misc queries) | |||
Calculate mean of test scores from rows of test answers | Excel Discussion (Misc queries) | |||
Copy form field value to another form (calendar) | Excel Programming | |||
hpw do I logic test a cell then copy the row to diff. SS | Excel Worksheet Functions | |||
How do I copy a Form from one VBAProject to another | Excel Programming |