I have 5, TextBoxes 1- 5 that post their data to Columns A-E on Worksheet 1
I need to see the data from the workbook in Columns A-E presented in the UserForm TextBoxes 1- 5 as I scroll the ScrollBar Up & down.
Hope this is clear.
Thanks
Printable View
I have 5, TextBoxes 1- 5 that post their data to Columns A-E on Worksheet 1
I need to see the data from the workbook in Columns A-E presented in the UserForm TextBoxes 1- 5 as I scroll the ScrollBar Up & down.
Hope this is clear.
Thanks
try like
you will need to set properties for scrollbar to prevent going out of range, also error handling to prevent 0 from causing errorvb Code:
Private Sub ScrollBar1_Change() r = ScrollBar1.Value For j = 1 To 5 Me.Controls("TextBox" & j) = Cells(r, j) Next End Sub
you may also want a textbox or label to show the current row being displayed
Simora, check the link in my signature for scrollbars...
Thanks for the ideas.
I Used something like ths
Code:Private Sub ScrollBar1_Change()
Dim row As Long
row = ScrLng(Me.ScrollBar1.Value)
With wks
Me.TextBox1.Text = .Cells(row, 1)
Me.TextBox2.Text = .Cells(row, 2)
' etc etc
End With
End Sub
*******************************
Private Sub UserForm_Initialize()
Set wks = Worksheets("Sheet1")
row_beginning = 2
row_ending = wks.Cells(row_beginning, 1).End(xlDown).row
With Me.ScrollBar1
.Value = row_beginning
.Min = row_beginning
.Max = row_ending
.LargeChange = 1
.SmallChange = 1
End With
Call ScrollBar1_Change
End Sub