Vertical to Horizontal Data using a VBA - Please Help!

excel103

New Member
Joined
May 24, 2018
Messages
4
Hello, I need help moving vertical data from Sheet 1 to horizontal on Sheet 2 thru a macro only, not a formula or copy and paste. Please see below.

SHEET 1
Due to headers on Sheet 1, data list starts at Cell A9 and currently ends at cell A150

Job #Job Name
1A
2B
3C
4D
5E

<tbody>
</tbody>

SHEET 2 - Job# and Job Name to be listed on cell A1 and A2. Data list to start on cell B1
Job #12345
Job NameABCDE

<tbody>
</tbody>


Thank you.
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
How about
Code:
Sub TransData()
   Dim ary As Variant
   ary = Sheets("Sheet1").Range("A9:B150")
   Sheets("sheet2").Range("b1").Resize(UBound(ary, 2), UBound(ary)).Value = Application.Transpose(ary)
End Sub
 
Upvote 0
Fluff,

I was able to resolve the adding of a column in between project types. I would like to extend the formatting from Sheet 1 (fill color and bold) to sheet 2. is that possible?
 
Upvote 0
Do all cells have the same formatting?
 
Upvote 0
No. The cells on Sheet 1 do not share the same formatting. However, could we add to that macro to fill each cell on Sheet 2 color grey and font on the cells to be bold?
 
Upvote 0
How about
Code:
Sub TransData()
   Dim ary As Variant
   ary = Sheets("sheet1").Range("A9:B150")
   With Sheets("sheet2").Range("B1").Resize(UBound(ary, 2), UBound(ary))
      .Value = Application.Transpose(ary)
      .Interior.Color = 10921638
      .Font.Bold = True
   End With
End Sub
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,214,926
Messages
6,122,306
Members
449,079
Latest member
juggernaut24

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top