I heart Excel
Board Regular
- Joined
- Feb 28, 2011
- Messages
- 66
Hello,
I have completed a form that has taken me a while to do now, and one of our users, who will need to access the form can't.
They get numerous errors in the VBA Part.
The automatic date script for todays date errors as does the hidden cells UCase error.
Here is the script I have on the Sheet -
Private Sub Worksheet_Change(ByVal Target As Range)
Select Case Target.Address
Case "$D$14"
If UCase(Target.Value) = "NO" Then
Rows("22:25").EntireRow.Hidden = True
Rows("17:19").EntireRow.Hidden = False
ElseIf UCase(Target.Value) = "YES" Then
Rows("22:25").EntireRow.Hidden = False
Rows("17:20").EntireRow.Hidden = True
End If
Case "$G$14"
If UCase(Target.Value) = "NO" Then
Rows("27:58").EntireRow.Hidden = True
ElseIf UCase(Target.Value) = "YES" Then
Rows("27:35").EntireRow.Hidden = False
Rows("36:58").EntireRow.Hidden = True
End If
Case "$D$30"
If UCase(Target.Value) = "NO" Then
Rows("38:41").EntireRow.Hidden = True
Rows("33:35").EntireRow.Hidden = False
ElseIf UCase(Target.Value) = "YES" Then
Rows("38:41").EntireRow.Hidden = False
Rows("33:36").EntireRow.Hidden = True
End If
Case "$G$30"
If UCase(Target.Value) = "NO" Then
Rows("43:58").EntireRow.Hidden = True
ElseIf UCase(Target.Value) = "YES" Then
Rows("43:51").EntireRow.Hidden = False
Rows("52:58").EntireRow.Hidden = True
End If
Case "$D$46"
If UCase(Target.Value) = "NO" Then
Rows("54:57").EntireRow.Hidden = True
Rows("49:51").EntireRow.Hidden = False
ElseIf UCase(Target.Value) = "YES" Then
Rows("54:58").EntireRow.Hidden = False
Rows("49:52").EntireRow.Hidden = True
End If
Case "$E$19"
If UCase(Target.Value) = "YES" Then
Rows("17").EntireRow.Hidden = True
Rows("20").EntireRow.Hidden = False
ElseIf UCase(Target.Value) = "NO" Then
Rows("17").EntireRow.Hidden = False
Rows("20").EntireRow.Hidden = True
End If
Case "$E$35"
If UCase(Target.Value) = "YES" Then
Rows("33").EntireRow.Hidden = True
Rows("36").EntireRow.Hidden = False
ElseIf UCase(Target.Value) = "NO" Then
Rows("33").EntireRow.Hidden = False
Rows("36").EntireRow.Hidden = True
End If
Case "$E$51"
If UCase(Target.Value) = "YES" Then
Rows("49").EntireRow.Hidden = True
Rows("52").EntireRow.Hidden = False
ElseIf UCase(Target.Value) = "NO" Then
Rows("49").EntireRow.Hidden = False
Rows("52").EntireRow.Hidden = True
End If
Case Else
Exit Sub
End Select
End Sub
And here is the script on the opening of the worksheet -
Private Sub Workbook_Open()
Dim objOLE As Object
For Each objOLE In Sheets("Annual Leave Form").OLEObjects
If TypeName(objOLE.Object) = "DTPicker" Then
objOLE.Object.Value = Date
End If
Next objOLE
End Sub
Any ideas what is going wrong, other users can access the form and work it from there PC's, but not from this one?! I have checked the settings and MAcros are enabled, etc
Any help would be very grateful, thanks
I have completed a form that has taken me a while to do now, and one of our users, who will need to access the form can't.
They get numerous errors in the VBA Part.
The automatic date script for todays date errors as does the hidden cells UCase error.
Here is the script I have on the Sheet -
Private Sub Worksheet_Change(ByVal Target As Range)
Select Case Target.Address
Case "$D$14"
If UCase(Target.Value) = "NO" Then
Rows("22:25").EntireRow.Hidden = True
Rows("17:19").EntireRow.Hidden = False
ElseIf UCase(Target.Value) = "YES" Then
Rows("22:25").EntireRow.Hidden = False
Rows("17:20").EntireRow.Hidden = True
End If
Case "$G$14"
If UCase(Target.Value) = "NO" Then
Rows("27:58").EntireRow.Hidden = True
ElseIf UCase(Target.Value) = "YES" Then
Rows("27:35").EntireRow.Hidden = False
Rows("36:58").EntireRow.Hidden = True
End If
Case "$D$30"
If UCase(Target.Value) = "NO" Then
Rows("38:41").EntireRow.Hidden = True
Rows("33:35").EntireRow.Hidden = False
ElseIf UCase(Target.Value) = "YES" Then
Rows("38:41").EntireRow.Hidden = False
Rows("33:36").EntireRow.Hidden = True
End If
Case "$G$30"
If UCase(Target.Value) = "NO" Then
Rows("43:58").EntireRow.Hidden = True
ElseIf UCase(Target.Value) = "YES" Then
Rows("43:51").EntireRow.Hidden = False
Rows("52:58").EntireRow.Hidden = True
End If
Case "$D$46"
If UCase(Target.Value) = "NO" Then
Rows("54:57").EntireRow.Hidden = True
Rows("49:51").EntireRow.Hidden = False
ElseIf UCase(Target.Value) = "YES" Then
Rows("54:58").EntireRow.Hidden = False
Rows("49:52").EntireRow.Hidden = True
End If
Case "$E$19"
If UCase(Target.Value) = "YES" Then
Rows("17").EntireRow.Hidden = True
Rows("20").EntireRow.Hidden = False
ElseIf UCase(Target.Value) = "NO" Then
Rows("17").EntireRow.Hidden = False
Rows("20").EntireRow.Hidden = True
End If
Case "$E$35"
If UCase(Target.Value) = "YES" Then
Rows("33").EntireRow.Hidden = True
Rows("36").EntireRow.Hidden = False
ElseIf UCase(Target.Value) = "NO" Then
Rows("33").EntireRow.Hidden = False
Rows("36").EntireRow.Hidden = True
End If
Case "$E$51"
If UCase(Target.Value) = "YES" Then
Rows("49").EntireRow.Hidden = True
Rows("52").EntireRow.Hidden = False
ElseIf UCase(Target.Value) = "NO" Then
Rows("49").EntireRow.Hidden = False
Rows("52").EntireRow.Hidden = True
End If
Case Else
Exit Sub
End Select
End Sub
And here is the script on the opening of the worksheet -
Private Sub Workbook_Open()
Dim objOLE As Object
For Each objOLE In Sheets("Annual Leave Form").OLEObjects
If TypeName(objOLE.Object) = "DTPicker" Then
objOLE.Object.Value = Date
End If
Next objOLE
End Sub
Any ideas what is going wrong, other users can access the form and work it from there PC's, but not from this one?! I have checked the settings and MAcros are enabled, etc
Any help would be very grateful, thanks