In Excel how to make Column Values to Column Headings

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a single Column in one Spreadsheet of a workbook, and the values have
to be Column headings in another spreadsheet in the same workbook. How can I
do this Programmatically? Any help is greatly appreciated.

Thanks.
J
 
Tools>Macro "Record New Macro"

Copy the range of cells(not more than 256) from source worksheet.

Switch to target worksheet and Paste Special>Transpose>OK>Esc.

Stop recording.

Gord Dibben Excel MVP
 
with worksheets("sheet1")
set rng = .Range(.Cells(1,1),.Cells(1,1).End(xldown))
End with
if rng.count <= 256 then
rng.copy
worksheets("Sheet2").Cells(1,1).PasteSpecial paste:=xlPasteAll,
Transpose:=True
end If
 
Back
Top