Good morning!
I've been working on this for a while. I have a UserForm named frmOptionComment. I'm trying to set focus to the top-most text box (Option01). Sadly, it's not working at all. No focus is set. Here is my code to open the UserForm:
...and here's the code behind the UserForm...
I've been working on this for a while. I have a UserForm named frmOptionComment. I'm trying to set focus to the top-most text box (Option01). Sadly, it's not working at all. No focus is set. Here is my code to open the UserForm:
VBA Code:
Sub OptionComment()
frmOptionComment.Show
End Sub
...and here's the code behind the UserForm...
VBA Code:
Private Sub UserForm_Initialize()
Application.EnableEvents = False
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Me.StartUpPosition = 0
Me.Left = Application.Left + (0.5 * Application.Width) - (0.5 * Me.Width)
Me.Top = Application.Top + (0.5 * Application.Height) - (0.5 * Me.Height)
OPTIONS_abbreviations.Value = Worksheets("Options").Range("D1")
OPTIONS_descriptions.Value = Worksheets("Options").Range("E1")
Option01.Value = Cells(ActiveCell.Row, "DG")
Option02.Value = Cells(ActiveCell.Row, "DH")
Option03.Value = Cells(ActiveCell.Row, "DI")
Option04.Value = Cells(ActiveCell.Row, "DJ")
Option05.Value = Cells(ActiveCell.Row, "DK")
Option06.Value = Cells(ActiveCell.Row, "DL")
Option07.Value = Cells(ActiveCell.Row, "DM")
Option08.Value = Cells(ActiveCell.Row, "DN")
Option09.Value = Cells(ActiveCell.Row, "DO")
Option10.Value = Cells(ActiveCell.Row, "DP")
Option11.Value = Cells(ActiveCell.Row, "DQ")
Option12.Value = Cells(ActiveCell.Row, "DR")
Option13.Value = Cells(ActiveCell.Row, "DS")
Option14.Value = Cells(ActiveCell.Row, "DT")
Option01.SetFocus
Application.EnableEvents = True
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub