Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

In Dire need for help - VBA macro needed!


  • Please log in to reply

#1
Burk

Burk

    New Member

  • Member
  • Pip
  • 2 posts
Hello,

I am utterly despaired, as I have to come up with a weird VBA code although I have never used VBA before...

Here is the the thing:

I Have once Excel sheet (Sheet1.xls) containing two columns: Column A contains the names of different persons, , & Column B the countries of the respective persons in alphabetical order; e.g.

ColumnA ColumnB
Pablo Argentina
Estefan Argentina
Michael Austria
Stephanie Austria
Franz Austria
Jerome Belgium
Clara Belgium
Alvaro Chile
Mikele Chile
Emanuele Chile

However, the # of names per country, as well as the countries themselves, vary from time to time, so the list is not constant!


I know have to export this list in a second worksheet (Sheet2.xls) such that the countries are displayed as headers in ColumnA, and the corresponding names are displayed below, whereby the alpabetical order of the countries is kept and the countryname and the last precedding name of a person are separated by an empty row:

ColumnA (Sheet2.xls)
Argentina
Pablo
Estefan

Austria
Michael
Stephan
Franz

Belgium
Jerome
Clara

Chile
etc

The problem is that I have to come up with a Macro that recognises the country name, displays it as a header, lists all the respectvie names following this header, then recognises when a new country name comes up, inserts an empty row, followed by the name of the new country and the names of the people from this country...

Any ideas??? Any help is mostly appreciated!
Many thanx!
  • 0

Advertisements


#2
KenshinX

KenshinX

    Member

  • Member
  • PipPip
  • 35 posts
here's a tutorial on macros
http://www.helpwithp...ro-tutorial.htm
  • 0

#3
dsm

dsm

    Member

  • Member
  • PipPip
  • 98 posts
Burk,
I have attached a VBA script that will do what you are trying to acheive.


Regards
dsm

Attached Files


  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP