Question : macro to insert headers

Hi Expertrs

Need a macro to insert headers ONE ROW above (that is miss one row then add the table header)....i.e. TABLE ONE: BREAKDOWN BY.....Etc as shown in the blank attachment........as shown...the size of the table can vary........


 

Answer : macro to insert headers

There you go, Use this ...

Saurabh...

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
Sub getheaders()
    Dim srow As Long

    srow = 2

    Do Until srow > Cells(Cells.Rows.Count, "A").End(xlUp).Row

        If InStr(1, Cells(srow, "A").Value, "table", vbTextCompare) > 0 Then
            Range("B" & srow + 2 & ":f" & srow + 2).Value = Cells(srow, "A").Value
            srow = srow + 3
        Else
            srow = srow + 1
        End If
    Loop




End Sub
Random Solutions  
 
programming4us programming4us