Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default Combine similiar rows

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
PAR PAR is offline
external usenet poster
 
Posts: 20
Default Combine similiar rows

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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default Combine similiar rows

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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I combine worksheets w/o enough rows to combine? Amanda W. Excel Worksheet Functions 3 June 9th 09 07:26 AM
SUMPRODUCT or some similiar function Lars Erik N. Excel Worksheet Functions 2 December 6th 06 09:01 AM
how to combine two similiar sheet Donna Excel Worksheet Functions 2 March 14th 06 08:55 AM
Looking for something similiar to MIN Steve Haack Excel Worksheet Functions 4 April 27th 05 09:46 AM
Max with similiar values within the range Darin Kramer Excel Programming 2 April 12th 05 10:28 AM


All times are GMT +1. The time now is 07:50 AM.

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

About Us

"It's about Microsoft Excel"