Results 1 to 9 of 9

Delete columns based on Column Headers using VBA

Threaded View

Vj Raj Delete columns based on... 08-13-2021, 09:48 AM
Vj Raj Re: Delete columns based on... 08-13-2021, 09:54 AM
alansidman Re: Delete columns based on... 08-13-2021, 10:03 AM
Vj Raj Re: Delete columns based on... 08-13-2021, 10:35 AM
nankw83 Re: Delete columns based on... 08-13-2021, 11:33 AM
Vj Raj Re: Delete columns based on... 08-13-2021, 12:24 PM
nankw83 Re: Delete columns based on... 08-13-2021, 12:29 PM
Vj Raj Re: Delete columns based on... 08-13-2021, 01:01 PM
nankw83 Re: Delete columns based on... 08-13-2021, 02:20 PM
  1. #1
    Forum Contributor
    Join Date
    06-08-2021
    Location
    Toronto
    MS-Off Ver
    2016
    Posts
    101

    Delete columns based on Column Headers using VBA

    Hi,

    I have an excel file that copies entire data from sheet1 to sheet2. But for the sake of reporting, sheet2 only needs to have few columns than sheet1. I would like to find a way to use VBA to delete individual columns based on their headers. The code that i use now selects entire column based on column number and it is not effective as the what is in column B this week will not be the same next week. So I will have to change the column number in the code every time which is counter productive.

    I've attached a sample file to show how two different weeks' data (in "Sheet1" and "Sheet2") looks like and how the report ("Report") should look like. In this file, the report copies all data from either Sheet 1 or Sheet 2 based on the week I am generating the report and then I need it to delete the extra columns, based on their header names.

    Appreciate any help offered.

    Thanks
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] How to sum columns based on two column headers as criteria
    By MyStix01 in forum Excel General
    Replies: 3
    Last Post: 11-17-2018, 11:20 AM
  2. Replies: 6
    Last Post: 12-13-2016, 03:06 PM
  3. Sum across columns based on column headers or count of columns
    By RandiLee in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-08-2016, 09:59 AM
  4. copy and paste columns based on column headers
    By patwary786 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-24-2015, 11:43 PM
  5. Count Number of occurences Across Columns based on Similar Column Headers
    By vidyuthrajesh in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-27-2013, 06:42 PM
  6. [SOLVED] Delete entire Columns based on different Headers (Array)
    By WITJ in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-13-2013, 02:46 PM
  7. Summary - Copy the columns based on column headers
    By rafiomeon in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-01-2012, 10:32 AM

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