I want to take select cells from other rows (2 and 3) and combinethem with row 1

C

crowl_adam

I have this data in my spread sheet

Header- MemberID, Plan, Coverage Type, Premium
Row 1 - ABC, Health, IND, $100
Row 2 - ABC, Dental, FAM, $50
Row 3 - ABC, Vision, FAM, $25

Is there a way I can combine the rows to get this:
Header - MemberID, Plan, Coverage Type, Premium, Plan, Coverage Type, Premium, Plan, Coverage Type, Premium
Row 1 - ABC, Health, IND, $100, Dental, FAM, $50, Vision, FAM, $25


I have multiple memebers in my spreadsheet and the data all runs vertically and I want to combine it and go horizontal.

Any help is greatly appreciated!
 
D

Don Guillett

I have this data in my spread sheet



Header- MemberID, Plan, Coverage Type, Premium

Row 1 - ABC, Health, IND, $100

Row 2 - ABC, Dental, FAM, $50

Row 3 - ABC, Vision, FAM, $25



Is there a way I can combine the rows to get this:

Header - MemberID, Plan, Coverage Type, Premium, Plan, Coverage Type, Premium, Plan, Coverage Type, Premium

Row 1 - ABC, Health, IND, $100, Dental, FAM, $50, Vision, FAM, $25





I have multiple memebers in my spreadsheet and the data all runs vertically and I want to combine it and go horizontal.



Any help is greatly appreciated!

Try this macro

Sub putonrowsSAS()
Dim i As Long
Dim lc As Long

For i = Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1
lc = Cells(i, Columns.Count).End(xlToLeft).Column + 1
If Cells(i + 1, 1) = Cells(i, 1) Then
Cells(i + 1, 2).Resize(, 200).Copy Cells(i, lc)
Rows(i + 1).Delete
End If
Next i
End Sub
 

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

Top