PC Review


Reply
Thread Tools Rate Thread

Combine similiar rows

 
 
=?Utf-8?B?TWlrZSBSLg==?=
Guest
Posts: n/a
 
      15th Jun 2007
Hi!
I am pulling a report in that shows different activities that a person has
completed. When I pull the report, the first column has the activity (there
are two different types of activities possible) and the rest of the columns
are name, address, city, state. I would like to to run a macro in which it
will add two columns (for each activity) and put a 'X' in the column in which
the acitivty is completed. Also, when I run the report, a person could be
list twice if they have both activities, I would like for them to show once.
So, take the data from:

ACTIVITY NAME ADDRESS CITY STATE
RUN Mike Smith 1122 NE 4th Ave Orlando FL
RUN John Doe 234 S. 5th Str Orlando FL
WALK Mike Smith 1122 NE 4tf Ave Orlando FL
WALK Bob Jones 43 East Ave Orlando FL

and turn it in to:

RUN WALK NAME
X X Mike Smith 1122 NE 4th Ave Orlando FL
X John Doe 234 S. 5th Str Orlando FL
X Bob Jones 43 East Ave Orlando FL


I have tried too many ways with no avail. Any help would be great. Thanks,
Mike


 
Reply With Quote
 
 
 
 
=?Utf-8?B?UEFS?=
Guest
Posts: n/a
 
      15th Jun 2007
Here's the answer! Remember to give some feedback!

Sub SOLUTION()

Dim irows As Integer
Dim iloop

Columns("B:B").Select
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight

Cells(1, 2) = "RUN"
Cells(1, 3) = "WALK"


irows = ActiveSheet.UsedRange.Rows.Count

For iloop = 2 To irows
If Cells(iloop, 1) = "RUN" Then Cells(iloop, 2) = "X"
If Cells(iloop, 1) = "WALK" Then Cells(iloop, 3) = "X"
Next iloop

Columns("A:A").Select
Selection.Delete Shift:=xlToLeft


End Sub

"Mike R." wrote:

> Hi!
> I am pulling a report in that shows different activities that a person has
> completed. When I pull the report, the first column has the activity (there
> are two different types of activities possible) and the rest of the columns
> are name, address, city, state. I would like to to run a macro in which it
> will add two columns (for each activity) and put a 'X' in the column in which
> the acitivty is completed. Also, when I run the report, a person could be
> list twice if they have both activities, I would like for them to show once.
> So, take the data from:
>
> ACTIVITY NAME ADDRESS CITY STATE
> RUN Mike Smith 1122 NE 4th Ave Orlando FL
> RUN John Doe 234 S. 5th Str Orlando FL
> WALK Mike Smith 1122 NE 4tf Ave Orlando FL
> WALK Bob Jones 43 East Ave Orlando FL
>
> and turn it in to:
>
> RUN WALK NAME
> X X Mike Smith 1122 NE 4th Ave Orlando FL
> X John Doe 234 S. 5th Str Orlando FL
> X Bob Jones 43 East Ave Orlando FL
>
>
> I have tried too many ways with no avail. Any help would be great. Thanks,
> Mike
>
>

 
Reply With Quote
 
=?Utf-8?B?TWlrZSBSLg==?=
Guest
Posts: n/a
 
      15th Jun 2007
Hi - Thanks for the reply. This definitely gets me close. Now I would like
to combine 'like' people down to one row and have the appropriate 'X' next to
them. How do I combine them down to one row.
Thanks again,
Mike

"PAR" wrote:

> Here's the answer! Remember to give some feedback!
>
> Sub SOLUTION()
>
> Dim irows As Integer
> Dim iloop
>
> Columns("B:B").Select
> Selection.Insert Shift:=xlToRight
> Selection.Insert Shift:=xlToRight
>
> Cells(1, 2) = "RUN"
> Cells(1, 3) = "WALK"
>
>
> irows = ActiveSheet.UsedRange.Rows.Count
>
> For iloop = 2 To irows
> If Cells(iloop, 1) = "RUN" Then Cells(iloop, 2) = "X"
> If Cells(iloop, 1) = "WALK" Then Cells(iloop, 3) = "X"
> Next iloop
>
> Columns("A:A").Select
> Selection.Delete Shift:=xlToLeft
>
>
> End Sub
>
> "Mike R." wrote:
>
> > Hi!
> > I am pulling a report in that shows different activities that a person has
> > completed. When I pull the report, the first column has the activity (there
> > are two different types of activities possible) and the rest of the columns
> > are name, address, city, state. I would like to to run a macro in which it
> > will add two columns (for each activity) and put a 'X' in the column in which
> > the acitivty is completed. Also, when I run the report, a person could be
> > list twice if they have both activities, I would like for them to show once.
> > So, take the data from:
> >
> > ACTIVITY NAME ADDRESS CITY STATE
> > RUN Mike Smith 1122 NE 4th Ave Orlando FL
> > RUN John Doe 234 S. 5th Str Orlando FL
> > WALK Mike Smith 1122 NE 4tf Ave Orlando FL
> > WALK Bob Jones 43 East Ave Orlando FL
> >
> > and turn it in to:
> >
> > RUN WALK NAME
> > X X Mike Smith 1122 NE 4th Ave Orlando FL
> > X John Doe 234 S. 5th Str Orlando FL
> > X Bob Jones 43 East Ave Orlando FL
> >
> >
> > I have tried too many ways with no avail. Any help would be great. Thanks,
> > Mike
> >
> >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to combine rows? Dina Microsoft Excel Misc 4 5th Mar 2010 08:35 AM
How do I combine worksheets w/o enough rows to combine? Amanda W. Microsoft Excel Worksheet Functions 3 9th Jun 2009 07:26 AM
Combine several like rows Dane Microsoft Excel Programming 1 10th Mar 2009 06:53 PM
how to combine two similiar sheet =?Utf-8?B?RG9ubmE=?= Microsoft Excel Worksheet Functions 2 14th Mar 2006 08:55 AM
how to combine the multiple rows into one rows? =?Utf-8?B?UnVzeQ==?= Microsoft Excel Worksheet Functions 0 19th Jul 2005 02:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:30 PM.