?
Solved

Macro for xls report

Posted on 2014-09-10
2
Medium Priority
?
293 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: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
  • Learn & ask questions
2 Comments
 
LVL 52

Accepted Solution

by:
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

by:Ivano Viola
ID: 40314882
Great....thanks for your help.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

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…

752 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