Consulting

Results 1 to 4 of 4

Thread: Select and delete entire columns

  1. #1

    Select and delete entire columns

    Hi everybody,

    I have a range activated
    Range(strPlageSélectionnée).Activate


    , and i'm looking for selecting their entire columns in order to delete them. I know that to select a column there is a specific formula
    ActiveCell.EntireColumn.Select


    and to delete one column it's
    ActiveCell.EntireColumn.Delete


    But how can i select and delete many columns at once. Is there any specific formula ?

    Thanks for your help
    Image1.jpgImage2.jpgImage3.jpgImage4.jpg
    Last edited by Ramo964516; 02-28-2016 at 01:27 PM.

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,726
    Location
    Maybe

    Selection.EntireColumn.Delete
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  3. #3
    Hi Paul_Hossler,
    I used
    Range(strPlageSélectionnée).EntireColumn.Delete
    and it works. thanks for your help

  4. #4
    Hello Ramo964516,

    Alternatively, if you want to delete contiguous ranges based on a single selected cell, such as G1 for example, you can do this -

    Range(strPlageSélectionnée).Resize(, 2).EntireColumn.Delete  ' change 2 to any number of contiguous columns
    Hope that helps!
    Last edited by williedog; 03-03-2016 at 08:38 AM.

Posting Permissions

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