Hi,
I have this code that I want to use to set every 5th row bottom border medium with. I managed to use it on its own in a test file but when I insert this into my main document, I keep getting: "Run-time error '91: Object variable or With block variable not set"
The first line works and will make the 6th row bottom edge medium at the proper ranges, which in turn means that tableRng is not the problem;
The 2nd row however gives the run-time error, suggesting that (i) is someone responsible. I also tried changing (i) to other letters not used anywhere in the VBA with no luck.
Anyone have any ideas why this might be?
Thank you for looking!
I have this code that I want to use to set every 5th row bottom border medium with. I managed to use it on its own in a test file but when I insert this into my main document, I keep getting: "Run-time error '91: Object variable or With block variable not set"
The first line works and will make the 6th row bottom edge medium at the proper ranges, which in turn means that tableRng is not the problem;
The 2nd row however gives the run-time error, suggesting that (i) is someone responsible. I also tried changing (i) to other letters not used anywhere in the VBA with no luck.
Anyone have any ideas why this might be?
Code:
Dim i As Long
For i = 2 To 47 Step 5
'Intersect(Rows(6), tableRng).Borders(xlEdgeBottom).Weight = xlMedium
Intersect(Rows(i), tableRng).Borders(xlEdgeBottom).Weight = xlMedium
Next i
Thank you for looking!