Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Macro to Find Column

I have several spreadsheet with a column for e-mail address. Some cells have
two e-mail addresses. I need to separate the addresses so that there is only
one address per cell, then delete the second address. This is easy to do
using text-to-columns and I recorded a macro to do just that.

The problem is that the column where the addresses are located can change
between files. In one file it's column A. In another file it's column D.
When I record a macro, it's the same column every time (always column A), so
the macro doesn't work for every file.

Can someone give me code that will find the address, then separate them,
then delete the extra?

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Macro to Find Column

Record the macro with relative reference and put your cursor on the column
where the email address are and run it.

"User" wrote:

I have several spreadsheet with a column for e-mail address. Some cells have
two e-mail addresses. I need to separate the addresses so that there is only
one address per cell, then delete the second address. This is easy to do
using text-to-columns and I recorded a macro to do just that.

The problem is that the column where the addresses are located can change
between files. In one file it's column A. In another file it's column D.
When I record a macro, it's the same column every time (always column A), so
the macro doesn't work for every file.

Can someone give me code that will find the address, then separate them,
then delete the extra?

Thanks!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Macro to Find Column

You may want to have the user select the column and have your macro work with
that (or use the activecell's column).

Or you could find (like Edit|Find) a keyword in the header row (if there is a
header row and the keyword doesn't change (and is unique, too!)).



User wrote:

I have several spreadsheet with a column for e-mail address. Some cells have
two e-mail addresses. I need to separate the addresses so that there is only
one address per cell, then delete the second address. This is easy to do
using text-to-columns and I recorded a macro to do just that.

The problem is that the column where the addresses are located can change
between files. In one file it's column A. In another file it's column D.
When I record a macro, it's the same column every time (always column A), so
the macro doesn't work for every file.

Can someone give me code that will find the address, then separate them,
then delete the extra?

Thanks!


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to find and move column andrea Excel Discussion (Misc queries) 1 October 9th 08 02:22 PM
Find next blank column with Macro samijleeds Excel Programming 9 October 8th 07 07:59 AM
Macro to find end of column data [email protected][_2_] Excel Programming 2 August 10th 07 02:28 PM
Macro to find end of column data [email protected][_2_] Excel Programming 1 August 9th 07 05:43 PM
Need Macro to Find Column Heading -- if none, then insert new column Jeff[_43_] Excel Programming 0 December 15th 04 07:08 AM


All times are GMT +1. The time now is 07:28 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"