View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Repeating Column header for each row

First, I think keeping the data in a nice tabular form is usually much better.

There are lots of things that will become more difficult if you do this.

But if you want, you can use a macro:

Option Explicit
Sub testme()

Dim wks As Worksheet
Dim iRow As Long
Dim FirstRow As Long
Dim LastRow As Long
Dim HeaderRow As Long

Set wks = Worksheets("sheet1")
With wks
HeaderRow = 1
FirstRow = 2
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row

For iRow = LastRow To FirstRow + 1 Step -1
.Rows(HeaderRow).Copy
.Rows(iRow).Insert
Next iRow
End With
Application.CutCopyMode = False
End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

jamex wrote:

How to repeat column header for each row

NAME JOB SALARY
AAA CLERK 5000
BBB MANAGER 6000
CCC CASHIER 7000

I want result as:

NAME JOB SALARY
AAA CLERK 5000
NAME JOB SALARY
BBB MANAGER 6000
NAME JOB SALARY
CCC CASHIER 7000

--
jamex
------------------------------------------------------------------------
jamex's Profile: http://www.excelforum.com/member.php...o&userid=32243
View this thread: http://www.excelforum.com/showthread...hreadid=537447


--

Dave Peterson