+ Reply to Thread
Results 1 to 5 of 5

I am trying to remove few columns with VBA

  1. #1
    Registered User
    Join Date
    03-06-2019
    Location
    Canada
    MS-Off Ver
    Office 365
    Posts
    79

    Exclamation I am trying to remove few columns with VBA

    Hi Friends,

    I am trying to remove the column based on their name with the help of below code but its giving error after deleting one column. Thanks for help.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: I am trying to remove few columns with VBA

    A couple of rules of thumb I follow:
    1. Only create variables for things that are going to be used multiple times throughout a lengthy macro. If it's one use, just reference it.
    2. Try not to make big physical changes to a workbook over and over. Try to make all the changes all at once, when possible.

    With that in mind, this is my approach. Find all the cells, memorize them, then delete all the found columns all at once, one time.
    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,088

    Re: I am trying to remove few columns with VBA

    its giving error after deleting one column.
    What is the error message?
    - Battle without fear gives no glory - Just try

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,788

    Re: I am trying to remove few columns with VBA

    How about
    Please Login or Register  to view this content.

  5. #5
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: I am trying to remove few columns with VBA

    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 03-05-2020 at 03:57 PM. Reason: Added required CODE tags as per FORUM RULES.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Macro to Remove Columns & Then Re-Order Remaining Columns
    By newbieexceldude in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 01-01-2017, 03:36 AM
  2. Code to remove compare and remove duplicate value between 2 columns
    By winmaxservices1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-22-2015, 02:30 PM
  3. Compare 2 columns and remove duplicates in both columns when found
    By 1dtms in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-11-2013, 02:19 AM
  4. MAcro to - copy, transpose, text to columns, remove column A, combine all columns in 1
    By galvinpaddy in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 02-07-2013, 08:48 AM
  5. excel macro to remove specific columns and rows + remove duplicate
    By garrywelson in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 01-17-2013, 12:03 PM
  6. Replies: 3
    Last Post: 06-09-2011, 05:58 AM
  7. Remove 2 Columns
    By vbjohn in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-25-2009, 06:17 PM

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