B
Brian Belliveau
I've got two more questions ...
Having the routine to open the rows, I need to apply that to opening the
required columns. I assume that the columns are referred to numerically,
rather than alphabetically? When I run the routine, the first part runs fine
(opening rows), but the second part generates the error message :
Run-time error '1004':
Application-defined or object-defined error
(This occurred with the two routines below combined as one)
Seperating them ( as pasted here ) and running it on its' own gives the
error message:
400
Any help for this ?
Second question ... Can the line "If RowRange.Cells(r, 1).Value = "X" Then"
test for multiple situations, such as upper & lower case, or must it be a
seperate "If" statement?
Once again, I thank you all.
Sub RowUnhide()
'This part opens 2 rows for each employee, in 1st & 2nd weeks
Dim RowRange As Range
Dim r1 As Integer, r2 As Integer, r3 As Integer, r4 As Integer
Set RowRange = Worksheets("Employees").Range("D322")
For r = 3 To 22
If RowRange.Cells(r, 1).Value = "X" Then
r1 = 44 + (2 * r)
r2 = 44 + (2 * r) + 1
r3 = 294 + (2 * r)
r4 = 294 + (2 * r) + 1
Worksheets("PayPeriod_01").Rows(r1 & ":" & r2).Hidden = False
Worksheets("PayPeriod_01").Rows(r3 & ":" & r4).Hidden = False
End If
Next
'second routine placed here, without the "Sub ColUnhide()" part
End Sub
-------------------------------------------------------------------
Sub ColUnhide()
'This part opens 2 columns for each job in progress
Dim ColRange As Range
Dim c1 As Integer, c2 As Integer
Set ColRange = Worksheets("Jobs").Range("F4:F100")
For c = 4 To 100
If ColRange.Cells(c, 1).Value = "X" Then
c1 = -3 + (2 * c)
c2 = -3 + (2 * c) + 1
Worksheets("PayPeriod_01").Columns(c1 & ":" & c2).Hidden = False
End If
Next
End Sub
Having the routine to open the rows, I need to apply that to opening the
required columns. I assume that the columns are referred to numerically,
rather than alphabetically? When I run the routine, the first part runs fine
(opening rows), but the second part generates the error message :
Run-time error '1004':
Application-defined or object-defined error
(This occurred with the two routines below combined as one)
Seperating them ( as pasted here ) and running it on its' own gives the
error message:
400
Any help for this ?
Second question ... Can the line "If RowRange.Cells(r, 1).Value = "X" Then"
test for multiple situations, such as upper & lower case, or must it be a
seperate "If" statement?
Once again, I thank you all.
Sub RowUnhide()
'This part opens 2 rows for each employee, in 1st & 2nd weeks
Dim RowRange As Range
Dim r1 As Integer, r2 As Integer, r3 As Integer, r4 As Integer
Set RowRange = Worksheets("Employees").Range("D322")
For r = 3 To 22
If RowRange.Cells(r, 1).Value = "X" Then
r1 = 44 + (2 * r)
r2 = 44 + (2 * r) + 1
r3 = 294 + (2 * r)
r4 = 294 + (2 * r) + 1
Worksheets("PayPeriod_01").Rows(r1 & ":" & r2).Hidden = False
Worksheets("PayPeriod_01").Rows(r3 & ":" & r4).Hidden = False
End If
Next
'second routine placed here, without the "Sub ColUnhide()" part
End Sub
-------------------------------------------------------------------
Sub ColUnhide()
'This part opens 2 columns for each job in progress
Dim ColRange As Range
Dim c1 As Integer, c2 As Integer
Set ColRange = Worksheets("Jobs").Range("F4:F100")
For c = 4 To 100
If ColRange.Cells(c, 1).Value = "X" Then
c1 = -3 + (2 * c)
c2 = -3 + (2 * c) + 1
Worksheets("PayPeriod_01").Columns(c1 & ":" & c2).Hidden = False
End If
Next
End Sub