B
Brian Belliveau
Following up to my earlier post (Macro to unhide selected columns and rows)
....
Given this line to unhide 2 specific rows ...
Worksheets("PayPeriod_01").Rows("50:51").Hidden = False
How do I use variables to represent ... Rows("50:51")
I've tried ...
Dim MyRange As Range, r1 As Range, r2 As Range, r3 As Range, r4 As Range
Set MyRange = Worksheets("Employees").Range("D322")
For c = 3 To 22
If MyRange.Cells(c, 1).Value = "X" Then
Set r1 = 44 + (2 * c)
Set r2 = 44 + (2 * c) + 1
Set r3 = 294 + (2 * c)
Set r4 = 294 + (2 * c) + 1
Worksheets("PayPeriod_01").Rows(r1, r2).Hidden = False
Worksheets("PayPeriod_01").Rows(r3, r4).Hidden = False
I'm sure my syntax is incorrect, but I just simply can't figure out the
correct way.
( Is it just me, or is "help" a terrible name for what happens when you
press F1?)
Thanks
....
Given this line to unhide 2 specific rows ...
Worksheets("PayPeriod_01").Rows("50:51").Hidden = False
How do I use variables to represent ... Rows("50:51")
I've tried ...
Dim MyRange As Range, r1 As Range, r2 As Range, r3 As Range, r4 As Range
Set MyRange = Worksheets("Employees").Range("D322")
For c = 3 To 22
If MyRange.Cells(c, 1).Value = "X" Then
Set r1 = 44 + (2 * c)
Set r2 = 44 + (2 * c) + 1
Set r3 = 294 + (2 * c)
Set r4 = 294 + (2 * c) + 1
Worksheets("PayPeriod_01").Rows(r1, r2).Hidden = False
Worksheets("PayPeriod_01").Rows(r3, r4).Hidden = False
I'm sure my syntax is incorrect, but I just simply can't figure out the
correct way.
( Is it just me, or is "help" a terrible name for what happens when you
press F1?)
Thanks