Macro to Copy & highlight every so many rows

rjacmuto32

Board Regular
Joined
Jul 14, 2004
Messages
98
I have 101 rows of data with row 1 being my header row. I want to do a macro to highlight every 10 rows all the way to the end. So I want rows 11,21,31,etc to be highlighted. I also would like to copy whatever is in column B to a new worksheet. So I'm trying to highlight rows 11,21,31 and then copy cell b11,b21,b31, etc into a new worksheet.

Thanks.
 

Some videos you may like

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

agihcam

Well-known Member
Joined
Jan 16, 2006
Messages
1,624
try;
Code:
Sub testit()
Dim i As Long
For i = 11 To Range("A" & Rows.Count).End(xlUp).Row Step 10
    Cells(i, "a").Interior.Color = vbYellow
    Sheets("Sheet2").Range("a" & Rows.Count).End(xlUp).Offset(1) = Cells(i, "b").Value
Next
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,113,848
Messages
5,544,640
Members
410,627
Latest member
georgealice
Top