A Microsoft Excel forum. ExcelBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » ExcelBanter forum » Excel Newsgroups » Excel Programming
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

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



 
 
Thread Tools Display Modes
  #1  
Old August 6th 12, 09:53 PM posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default I want to take select cells from other rows (2 and 3) and combinethem with row 1

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!

Ads
  #2  
Old August 7th 12, 05:33 PM posted to microsoft.public.excel.programming
Don Guillett[_2_]
external usenet poster
 
Posts: 1,506
Default I want to take select cells from other rows (2 and 3) and combinethem with row 1

On Monday, August 6, 2012 3:53:31 PM UTC-5, (unknown) wrote:
> 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
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Select and rows to another cell if one of the cells contains data schleprock Excel Programming 2 February 5th 09 07:41 PM
How to select Visible Cells range minus 2 rows (frozen panes) LuisE Excel Programming 5 November 22nd 07 05:01 AM
select only used rows and only visible cells Rokuro kubi Excel Discussion (Misc queries) 2 September 28th 06 02:06 PM
Select filled cells/rows in a spreadsheet [email protected] Excel Programming 2 December 1st 05 12:29 AM
How do you select two cells in different rows and columns with ou. M.G Excel Discussion (Misc queries) 3 December 17th 04 11:39 PM


All times are GMT +1. The time now is 10:43 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright ©2004-2013 ExcelBanter.
The comments are property of their posters.