+ Reply to Thread
Results 1 to 4 of 4

Find text in ROW 1 and select corresponding column

  1. #1
    Registered User
    Join Date
    01-14-2008
    Posts
    18

    Find text in ROW 1 and select corresponding column

    I'd like to automate my macro even more if possible, to cut down on as much human error as possible.

    I'd like to find and select the columns to run the macro against.

    For example: I need to select Company, Contact, and Address columns (not state).

    So I'd like to search within my header row (row 1) for "Company" - select that column then (column A if that's where it appears), then go on to search for "First Name" and select column B (if that's where it appears), and so on, keeping adding to the selection.

    I'd also like to be able to search for other words that the header could be, for example: Company could be: Co or Firm

    Any ideas on how to do something like this?

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello jreimer,

    Here is a macro that will find the column header names you want and select all the columns found.

    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

  3. #3
    Registered User
    Join Date
    01-14-2008
    Posts
    18
    Leith -

    THANKS!! This looks to be exactly what I was looking for.

    So, I just add in the additional column names that I want to look for in this section?
    'Add the headers you want to search for in the Array
    Headers = Array("co", "Firm", "Address")

    When I copied and pasted the macro, i got an error and it highlighted this section:
    Cols.EntireColumn.Select

    I only know very little about macros, so I'm just getting the hang of this. Please let me know what I can do to make it work.

    Thanks again!!

  4. #4
    Registered User
    Join Date
    01-14-2008
    Posts
    18
    nevermind, it works. THANKS!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1