Applying formatting to non-continuous named ranges
Try using Intersect. This will apply the format to the intersection
of the column you want with the named range:
Change:
Range(Cells(StartRow, Col),cells(EndRow,Col)).locked = False
To:
Intersect(Range("OutputRng"),Cells
(StartRow,Col).EntireColumn).Locked = False
Change:
Range(Cells(StartRow, Col), Cells(EndRow, Col)).locked =
True
To:
Intersect(Range("OutputRng"),Cells(StartRow,
Col).EntireColumn).Locked = True
|