Loop through rows and paste content to text boxes

snoh8r

New Member
Joined
Jan 30, 2018
Messages
22
Office Version
  1. 365
Platform
  1. Windows
Code:
 Sheets("Job Tools").TextBox1.Value = Sheets("Analysis Update").Range("A2").Value
    Sheets("Job Tools").TextBox2.Value = Sheets("Analysis Update").Range("B2").Value
    Sheets("Job Tools").TextBox3.Value = Sheets("Analysis Update").Range("C2").Value
    Sheets("Job Tools").TextBox4.Value = Sheets("Analysis Update").Range("D2").Value
    Sheets("Job Tools").TextBox5.Value = Sheets("Analysis Update").Range("E2").Value
    Sheets("Job Tools").TextBox6.Value = Sheets("Analysis Update").Range("F2").Value
    Sheets("Job Tools").TextBox7.Value = Sheets("Analysis Update").Range("G2").Value
    Sheets("Job Tools").TextBox8.Value = Sheets("Analysis Update").Range("H2").Value

The above works great for copying everything from row 2 to the selected textbox. I'm trying to figure out how to loop through every following row until done. These text boxes are used by another macro and that's why I need to loop through. Any help is greatly appreciated.
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Hi,

to return values to your ActiveX Textboxes from a variable row try this:

Rich (BB code):
         Dim r As Long, c As Long
        r = 10
        For c = 2 To 8
            Worksheets("Job Tools").OLEObjects("TextBox" & c).Object.Value = _
            Worksheets("Analysis Update").Cells(r, c).Value
        Next c

where r is a variable your code determines which row to return (row 10 in this example)

Dave
 
Upvote 0

Forum statistics

Threads
1,223,710
Messages
6,174,017
Members
452,542
Latest member
Bricklin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top