I have a user form that's designed to come up when Excel opens, and the users name is not on the spreadsheet (i.e. it's the user's first time using the sheet).
Everything is working well, save the functionality to close the spreadsheet after OK_Click action in the user form. I've tried changing using userform.hide in both when conditions are met in the OK_Click action, and after the DO LOOP in the sub that calls the userform... neither have worked. Any suggestions?
Workbook open sub:
Private Sub Workbook_Open()
Sheets("Forecast").Select
MsgBox "Forecasting Sheet" & vbCrLf & "Release 0.2"
Do
ByValue = Range("A4").Value
If Len(ByValue) > 0 Then Exit Do
ConNameForm.Show vbModal
Loop
End Sub
Userform:
'
' User form designed to allow entry of consultant code. At present,
' this will input the Consultant's name into Cell Range "A4" on
' the "Forecast" sheet. Over time the value will be concatenated with
' with NMP object variables to be input to library file
'
Sub ConNameForm()
Dim ConFirstName As String
Dim ConLastName As String
Dim ConFullName As String
End Sub
Private Sub OK_Click()
If Len(ConFirstName) > 0 Then
If Len(ConLastName) > 0 Then
ConFullName = ConFirstName & " " & ConLastName
Range("A4").Value = ConFullName
End If
End If
End Sub
Private Sub ClearForm_Click()
ConFirstName.Text = ""
ConLastName.Text = ""
End Sub
Private Sub ConFirstName_Change()
ConFirstName = ConFirstName.Text
End Sub
Private Sub ConLastName_Change()
ConLastName = ConLastName.Text
End Sub
'Private Sub EnableSave()
' Set OK.Enabled = True
' Set ClearForm.Enabled = True
'End Sub
'Private Sub DisableSave()
' Set OK.Enabled = False
' Set ClearForm.Enabled = False
Thanks in advance for any help you can lend. If you're familiar with selecting shape objects in a Range in Excel, I've posted another issue I've run into with this work book here.
Bookmarks