Combine similiar rows

G

Guest

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
 
G

Guest

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
 
G

Guest

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
 

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