Userform TextBox Loop (retrieve data from sheet)

ricafonyat

New Member
Joined
May 1, 2017
Messages
9
Office Version
  1. 365
Platform
  1. Windows
I am trying to populate 10 TextBoxes in a Userform with values from Cells located in Sheet1 - Cells in Collumn E and starting in Row 4.
The below For Next Loop is not working correctly, because All textboxes are showing the same value ( Value from sheet1 cell E13)

VBA Code:
   Dim row As Long
   For counter = 1 To 10
      For row = 4 To 9
         Userform1.Controls("TextBox" & counter).Value = Sheet1.Cells(row, "E")
      Next row
   Next counter

Any help would be appreciated
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
How about
VBA Code:
Dim Counter As Long
For Counter = 1 To 10
   UserForm1.Controls("TextBox" & Counter).Value = Sheet1.Cells(Counter + 3, 5).Value
Next Counter
 
Upvote 0
Solution
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,929
Messages
6,122,315
Members
449,081
Latest member
tanurai

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