Trying to create a userform in VBA excel where in the text can be scrolled vertically to show what I add in specific cells of excel. I am using version 2016 of excel.
Have taken VBA code from google which is given below:
Private Sub UserForm_Initialize()
Me.Label1.Caption = Sheet1.Range("b4").Value
Me.Label2.Caption = Sheet1.Range("E9").Value & _
vbCrLf & vbCrLf & Sheet1.Range("E10").Value & _
vbCrLf & vbCrLf & Sheet1.Range("E11").Value & _
vbCrLf & vbCrLf & Sheet1.Range("E12").Value & _
vbCrLf & vbCrLf & Sheet1.Range("E13").Value
Me.Label2.Top = Me.Height
End Sub
This part of code works well when I comment Me.Label2.Top = Me.Height
this part of the code.
The second part of the code is for Vertical Scroll where in the scrolling happens however the loop where in the scrolling has to be repeated is not working. Code given below:
Sub verti_scroll()
Call UserForm1.Show(vbModeless)
Do
i = UserForm1.Height - 42
Do
i = i - 1
DoEvents
For a = i To 5000000
a = a + 1
Next
UserForm1.Label2.Top = i
If i = 100 Then GoTo Nextz
Loop
Nextz:
x = x + 1
If x = 2 Then GoTo nextx
Loop
nextx:
End Sub
Trying to create a userform in VBA excel where in the text can be scrolled vertically to show what I add in specific cells of excel. I am using version 2016 of excel.
The second part of the code is for Vertical Scroll where in the scrolling happens however the loop where in the scrolling has to be repeated which is not working or other option is to stop the vertical scroll on the user form.
If anyone can help with the code or any other way would be really appreciable.