P
Patti
I am creating a Sub to add borders to an area in my worksheet. The
following will work if I know the range:
Sub Borders()
With Range("a6:f300").Cells.Borders
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 1
End With
End Sub
But I can't use it because range will always vary. I know that my range
will always start in A6 and extend to F6. I don't know how may rows I will
have, but it will end when ever I run out of data in column A. Column F
will be empty except for the header in F6.
Since the following will select the correct area, I tried to use it to set a
range to use in the Sub Borders above. But every variation I have tried has
resulted in an error.
Sub RegionTest()
With [a6].CurrentRegion
.Resize(.Rows.Count).Select
End With
End Sub
What would be the best way to handle this?
TIA, Patti
following will work if I know the range:
Sub Borders()
With Range("a6:f300").Cells.Borders
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 1
End With
End Sub
But I can't use it because range will always vary. I know that my range
will always start in A6 and extend to F6. I don't know how may rows I will
have, but it will end when ever I run out of data in column A. Column F
will be empty except for the header in F6.
Since the following will select the correct area, I tried to use it to set a
range to use in the Sub Borders above. But every variation I have tried has
resulted in an error.
Sub RegionTest()
With [a6].CurrentRegion
.Resize(.Rows.Count).Select
End With
End Sub
What would be the best way to handle this?
TIA, Patti