Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 336
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default 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
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
Copy from form to worksheet Tony Excel Discussion (Misc queries) 0 May 15th 09 08:41 PM
Calculate mean of test scores from rows of test answers RiotLoadTime Excel Discussion (Misc queries) 1 July 26th 06 05:14 PM
Copy form field value to another form (calendar) [email protected] Excel Programming 1 December 1st 05 09:58 PM
hpw do I logic test a cell then copy the row to diff. SS Debi Excel Worksheet Functions 4 October 5th 05 09:42 PM
How do I copy a Form from one VBAProject to another Sean[_7_] Excel Programming 2 July 12th 04 02:49 PM


All times are GMT +1. The time now is 01:45 PM.

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

About Us

"It's about Microsoft Excel"