coliervile
02-26-2008, 07:03 AM
When CommandButton1 is clicked it performs its function, but when it selects worksheet "Dashboard" it actually selects it and highlights the whole page like when you click the top left corner of the worksheet. When CommandButton2 is clicked it does what it's suppose to do, but it actually selects worksheet "Dashboard" without hightlighting the whole page. Is there a reason this is taking place???
Best regards,
Charlie
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
With frmRequest.ListBox1
'Check for selected item
If (.Value <> vbNullString) Then
Range(.RowSource)(.ListIndex + 1, 1).Value = UserForm4.TextBox1.Value
Range(.RowSource)(.ListIndex + 1, 2).Value = UserForm4.TextBox2.Value
Range(.RowSource)(.ListIndex + 1, 3).Value = UserForm4.TextBox3.Value
Range(.RowSource)(.ListIndex + 1, 4).Value = UserForm4.TextBox4.Value
Range(.RowSource)(.ListIndex + 1, 5).Value = UserForm4.TextBox5.Value
Else
MsgBox "Please Enter Data"
End If
End With
'End With
Unload Me
Cells.Select
Selection.Sort Key1:=Range("D2"), Order1:=xlAscending, _
Key1:=Range("B2"), Order1:=xlAscending, _
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Sheets("Dashboard").Select
Application.ScreenUpdating = True
End Sub
Private Sub CommandButton2_Click()
Application.ScreenUpdating = False
Unload Me
Sheets("Dashboard").Select
Application.ScreenUpdating = True
End Sub
Best regards,
Charlie
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
With frmRequest.ListBox1
'Check for selected item
If (.Value <> vbNullString) Then
Range(.RowSource)(.ListIndex + 1, 1).Value = UserForm4.TextBox1.Value
Range(.RowSource)(.ListIndex + 1, 2).Value = UserForm4.TextBox2.Value
Range(.RowSource)(.ListIndex + 1, 3).Value = UserForm4.TextBox3.Value
Range(.RowSource)(.ListIndex + 1, 4).Value = UserForm4.TextBox4.Value
Range(.RowSource)(.ListIndex + 1, 5).Value = UserForm4.TextBox5.Value
Else
MsgBox "Please Enter Data"
End If
End With
'End With
Unload Me
Cells.Select
Selection.Sort Key1:=Range("D2"), Order1:=xlAscending, _
Key1:=Range("B2"), Order1:=xlAscending, _
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Sheets("Dashboard").Select
Application.ScreenUpdating = True
End Sub
Private Sub CommandButton2_Click()
Application.ScreenUpdating = False
Unload Me
Sheets("Dashboard").Select
Application.ScreenUpdating = True
End Sub