Solved

# Macro for xls report

Posted on 2014-09-10
Medium Priority
293 Views
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
Question by:Ivano Viola
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points

LVL 52

Accepted Solution

Rgonzo1971 earned 2000 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

ID: 40314882
0

## Featured Post

Question has a verified solution.

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

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
Having trouble getting your hands on Dynamics 365 Field Service or Project Service trial? Worry No More!!!
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
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…
###### Suggested Courses
Course of the Month11 days, 21 hours left to enroll