vertical to horizontal using VBA

Ruban S

New Member
Joined
Dec 31, 2019
Messages
33
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
 

Some videos you may like

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

6StringJazzer

Well-known Member
Joined
Jan 27, 2010
Messages
720
Office Version
  1. 365
Platform
  1. Windows
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())
 

Ruban S

New Member
Joined
Dec 31, 2019
Messages
33
Office Version
  1. 2016
Platform
  1. Windows
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.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
53,071
Office Version
  1. 365
Platform
  1. Windows
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
 
Solution

Watch MrExcel Video

Forum statistics

Threads
1,122,829
Messages
5,598,350
Members
414,232
Latest member
MIA10_KO

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
Top