Solved

Macro for xls report

Posted on 2014-09-10
2
268 Views
Last Modified: 2014-09-10
I have the attached an excel report. I need a macro to do the following:

Each row contains an applicant/student.
Starting from column AB (and onwards) there are sports listed. Some students have multiple sports listed in each column (one sport in each column).
I would like a macro that can combine each sport for each student into their AB column.  

So as an example (see attached). John Doe on row 2 has sports listed from AB to AH. The macro would combine all the sports in these column into AB (each sport on a new line in the AB cell).
Jane Doe has sports listed from AB to AX. These sports should be combined into AB (each sport on a separate line in the cell AB).

The macro should process each row where here is a student/applicant listed.
Hope you can help.

Much appreciated.

IV
Visitors.xls
0
Comment
Question by:ivanoviola
2 Comments
 
LVL 49

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 40314595
Hi,

pls try

Sub macro()
Dim arrRange
For Each c In Range("AB2", Range("AB" & Rows.Count).End(xlUp))
    Set myRange = Range(c, c.End(xlToRight))
    arrRange = myRange
    myRange.ClearContents
    c.Value = Join(WorksheetFunction.Index(arrRange, 1, 0), Chr(10))
Next
End Sub

Regards
VisitorsV1.xls
0
 
LVL 21

Author Closing Comment

by:ivanoviola
ID: 40314882
Great....thanks for your help.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now