473,386 Members | 1,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Easy Problem

To the VB universe,

Although I'm familiar with C++, it has been a while since I've done any programming and am having problems translating that knowledge to Visual Basic.

I'm trying to create a macro in Excel that will automatically sort a file that is formatted in two columns as shown below.

A B
John Smith Jane Rib
John Smith Sam Smith
John Smith Dirt McGerk
Julian Lennon Yoko Ono
Julian Lennon Paul McCartney
Sampson Simpson Dirk Diggler


into a format like:


John Smith
Jane Rib
Sam Smith
Dirt McGerk

Julian Lennon
Yoko Ono
Paul McCartney

Sampson Simpson
Dirk Diggler

I would appreciate any advice/help/direction that anyone can provide.

Thanks,
Fisticuffs
Oct 30 '06 #1
3 1207
AricC
1,892 Expert 1GB
Are you trying to do this in VB or in Excel? If in Excel why don't you just record a macro?
Oct 30 '06 #2
I'm trying to do this in excel.

Why don't I record a macro? Good question.(What's the benefits of a macro vs. VB code?) Would that be easier? If so, let me know the basics and I'll run with it.

The file that I'll be formatting will be a different number of names each week, if that means anything.

Fisticuffs
Oct 30 '06 #3
AricC
1,892 Expert 1GB
Got this from MSDN blog:

Macros vs. VBA
As many people have pointed out, macros do not offer the same range of functionality that VBA does. It's kind of interesting that some people even think that Macros were some sort of pre-VBA functionality that Access had. This is actually false - both macros and VBA were introduced in the same Access version (do you know which?).

Macros were thought as kind of a more structured, entry-level way to code in Access, while VBA had the steeper learning curve but had the full range of functionality on its hands.

So, why should you use macros?

I'm not even going to make the cheesy comment that anyone that ever used the DoCmd functions (e.g. DoCmd.OpenForm) were really using macro actions. Because, you know, that's actually not 100% true: the DoCmd commands were exposed at the same time to macros and VBA - they are different entry points to the same infrastructure.

I think the answer lies in the corollary: Don't Write Code Unless You Absolutely Must. And that is coming from someone that writes code pretty much all day long.

I believe that there is a use for macros (besides the obvious cases where you don't have an option, such as the AutoExec macro), and that use may very well be when you need to do something very simple (programmatically speaking, e.g. open a form) but you don't want to have the IT police freak out when they see VBA code.

I would do a macro if you can, it will save you some time unless your a VBA expert and could write the code quickly.

HTH,
AricC
Oct 30 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Martin Bootsma | last post by:
I have a C question, which looks very easy, but no one here seems to know an easy answer. I have a function "powell" (from Numerical Recipes) which takes an argument of the type "double...
4
by: n | last post by:
Hello! Here is a problem I hope you can point me to a solution. It Problem: A teacher needs to know which lesson to teach. A school has a curriculum with 26 lessons, A-Z. For a given class,...
9
by: thetechturf.com | last post by:
I have got a small problem getting my dropdown menu to work. I want to change the style with javascript. Here is the code in my HTML: <div id="navigation"> <ul> <li id="lnot"><a...
2
by: Jiwei06xie | last post by:
Hi All, I am trying to upgrade an Access 2000 DB to 2007 (using linked tables and ODBC to connect to backend SQL 2000 database). In my DB, I have a mainswitch board and some command buttons on it....
0
by: teddarr | last post by:
I have a Windows Server 2003. I am trying to run multiple websites on the server. I am using host headers to run the websites on only one ip address. Before anyone says this is an iis issue and...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.