By active cells I assume you mean all the cells currently selected. I think there can only be one active cell. This code should work:
Sub FormatBorders()
For x = 7 To 10
With Selection.Borders(x)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 1
End With
Next x
End Sub
Change "7 to 10" to "1 to 4" if you want inner and outer borders.
-Ben
Actually, by active, I meant all cells with data in them. So, I want the macro to do the selection of all cells with data and then place a border around those cells.
Thanks,
Mark
You could also use conditional formatting, negating the need for VBA. Just set the conditional format to Cell is not equal to: -- and select an empty cell (one that you know will always be empty)....
You could just format your whole area like this, and it will put a border around those cells that have values in them.