+ Reply to Thread
Results 1 to 6 of 6

Format & Delete based on Header Contents

  1. #1
    Forum Contributor
    Join Date
    02-24-2010
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2003
    Posts
    195

    Exclamation Format & Delete based on Header Contents

    Hey folks,

    I've attached a workbook containing one of many formatting macros that I use reulary.
    This macro is used in conjunction with a data-dump file in order to populate files.

    As it stands the process involves copying all information from the data dump file, that meets a criteria into a blank Excel file and then running the attached formatting macro.

    As you'll see the code deletes and moves certain columns.

    What I am trying to do is have the columns being moved and deleted based on whether or not the header of the column within the datadump can be found on 'Formatting Macro - Sheet 1' Header.

    Any ideas on what would be the best way to go about this?
    Attached Files Attached Files
    Last edited by TonyforVBA; 06-06-2012 at 04:27 AM.

  2. #2
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Format & Delete based on Header Contents

    TonyforVBA,

    Could you provide more detail? I for one do not fully understand what you want. If possible provide a "Before" and "After" example.
    Charles

    There are other ways to do this, this is but 1 !
    Be Sure you thank those who helped.
    IF YOU'RE SATISFIED BY ANY MEMBERS RESPONSE TO YOUR ISSUE PLEASE USE THE STAR ICON AT THE BOTTOM LEFT OF THE POST UNDER THEIR NAME.

  3. #3
    Forum Contributor
    Join Date
    02-24-2010
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2003
    Posts
    195

    Re: Format & Delete based on Header Contents

    Hi Charles,
    Thanks for getting back to me. I've ameneded the attachment to include a sample data dump sheet.

    You will notice that the desired order of the columns in Sheet1 iws differant to the order of datadump, where the information is taken from.

    The way that the macro currently works, is that when the datadump info is pasted into Sheet1.
    The macro in Module 1, deletes or moves columns based on how the final output is to appear.

    I have a number of these formatting macros to create differant views of this information from the datadump.

    Basically I am lookng for away that the macro will delete or move columns, based on the desired columns (as outlined in the header of sheet1).

    I hope this makes better sense.
    Thanks for your help./
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    02-24-2010
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2003
    Posts
    195

    Re: Format & Delete based on Header Contents

    This might help to clarify what I am trying to do.
    I need to go through each of the cells in the first row, copy the contents (eg. 'Acc no') <- We'll call this the variable

    Then search the data Dump based on the the variable.

    Would anybody have any idea of how to go about this?

    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Format & Delete based on Header Contents

    Tony,

    This what I came up with.
    You will find a "Test" button on sheet1. When you click it the code should remove header in sheet 2 that does not match sheet1.
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    02-24-2010
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2003
    Posts
    195

    Re: Format & Delete based on Header Contents

    Charles, that should perfect for what I need it to do.

    Thanks for your help and your patience!

+ 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