every fifth line

J

Jock

Hi,
By vba, how can I
a) insert a bold black border along the top edge of every fifth row down to
about row 1000 ( and along the row to K)?
b) make every fifth cell in column K a dropdown list using data validation?

Thanks
 
S

Sam Wilson

Sub demo()
Dim i As Integer
With Range("a1")

For i = 0 To 200
.Offset(i * 5, 10).Validation.Add Type:=xlValidateList,
AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="=$D$1:$D$4"
.Offset(i * 5, 0).Resize(1, 11).Borders(xlEdgeTop).Weight = xlThin
Next i
End With

End Sub
 
A

Andrew Taylor

You can do the border part without VBA by using conditional
formatting.
Select the whole range, then Format/Conditional Formatting,
formula is =MOD(ROW(),5)=0 and format of heavy underline.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top