vertical to horizontal using VBA

Ruban S

New Member
Joined
Dec 31, 2019
Messages
35
Office Version
  1. 2016
Platform
  1. Windows
Hi Everyone,

I need a macro for transferring data from vertical to horizontal.

I have like this

ID Name
ENVM100010 TYPE
ENVM100010 COMPRISING
ENVM100010 SIZE/DIMENSIONS
ENVM100010 MATERIAL
ENVM100010 RATING/CAPACITY
ENVM100010 APPLICATION
ENVM100010 STANDARDS
ENVM100010 PACKAGE DATA
ENVM100010 ADDITIONAL INFO

I need like this

ENVM100010 TYPE COMPRISING SIZE/DIMENSIONS MATERIAL RATING/CAPACITY APPLICATION STANDARDS PACKAGE DATA ADDITIONAL INFO

like this for many id and names
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
This can be done without a macro.

Method 1: Select the column. Copy. Select the starting destination cell. Paste Special, Transpose

Method 2: Formula starting the first destination cell and copy to the right:
Excel Formula:
=INDEX(Sheet1!A:A,COLUMN())
 
Upvote 0
This can be done without a macro.

Method 1: Select the column. Copy. Select the starting destination cell. Paste Special, Transpose

Method 2: Formula starting the first destination cell and copy to the right:
Excel Formula:
=INDEX(Sheet1!A:A,COLUMN())
Thank you for the reply. But i cant do this because i have around 5000 rows like this.
 
Upvote 0
How about
VBA Code:
Sub RubanS()
   Dim Cl As Range
   
   With CreateObject("scripting.dictionary")
      For Each Cl In Range("A2", Range("A" & Rows.count).End(xlUp))
         .Item(Cl.Value) = .Item(Cl.Value) & Cl.Offset(, 1).Value & "|"
      Next Cl
      Range("D2").Resize(.count, 2).Value = Application.Transpose(Array(.Keys, .Items))
      Range("E2").Resize(.count).TextToColumns Range("E2"), xlDelimited, , , 0, 0, 0, 0, 1, "|"
   End With
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,213,553
Messages
6,114,279
Members
448,562
Latest member
Flashbond

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