creating list of column headers

  • Thread starter Thread starter rfhurley
  • Start date Start date
R

rfhurley

Hi

I'm trying to create a list of column headers for an enormous
spreadsheet, and I was wondering if there was an easy way to do this
without cutting each header individually and pasting it into a single
column.
 
You could just select the row where all the headers are and Copy them.
Instead of paste, use Edit>Paste Special and then select Transpose.
 
Hi rfhurley,
I'm trying to create a list of column headers for an enormous
spreadsheet, and I was wondering if there was an easy way to do this
without cutting each header individually and pasting it into a single
column.

I don't know if I understand exactly what you want to do. But here's some
code that will take the first row (assuming those are your headers) and put
them in a list in one column starting at A2 on the same sheet. This could
be adapted easily to place the list on a different sheet if you want.

Sub test()
Dim nLastCol As Integer

With ActiveSheet
nLastCol = .Cells(1, .Columns.Count).End( _
xlToLeft).Column
.Range(.Cells(1, 1), .Cells(1, nLastCol)).Copy
.Range("A2").PasteSpecial Paste:=xlPasteValues, _
Transpose:=True
End With
End Sub

--
Regards,

Jake Marx
www.longhead.com


[please keep replies in the newsgroup - email address unmonitored]
 
Thank you, Mike. It worked like a charm.


Mike said:
You could just select the row where all the headers are and Copy them.
Instead of paste, use Edit>Paste Special and then select Transpose.
 

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

Back
Top