Hi all
I am trying to write a code that selects a number of cells around the active cell depending on the value of cells A500 and C500 and then draws a boarder around them.
So far i have the following but I need to change the ActiveCell(6,6) so it uses the values in A500 and C500 instead of 6 and 6 but i cant seem to do it.
I would appreciate any help
I am trying to write a code that selects a number of cells around the active cell depending on the value of cells A500 and C500 and then draws a boarder around them.
So far i have the following but I need to change the ActiveCell(6,6) so it uses the values in A500 and C500 instead of 6 and 6 but i cant seem to do it.
Code:
Sub Select6()
Range(ActiveCell(1, 1), ActiveCell(6, 6)).Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
End Sub
I would appreciate any help