+ Reply to Thread
Results 1 to 5 of 5

Selecting a range of columns based on a cell value

  1. #1
    Registered User
    Join Date
    01-20-2009
    Location
    newcastle
    MS-Off Ver
    Excel 365
    Posts
    59

    Selecting a range of columns based on a cell value

    Good morning.

    I am deleting a range of columns once a month using the following as part of a bigger routine


    Columns("B:CI").Select
    Selection.Delete


    The column selction always starts at "B" however the width changes every month.

    B:CI =Jan 2016
    B:CJ =Feb 2016
    B:CK =March 2016

    On a seperate worksheet I want to be able to type "CK" in a specific cell and the macro to select columns B:CK, likewise if I typed "DE" in the specified cell the macro would choose columns B:DE

    Many thanks
    Phil

  2. #2
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628

    Re: Selecting a range of columns based on a cell value

    You could use this code:
    Please Login or Register  to view this content.
    where in range A1 you write CI or CJ or other.

    You could also use this code:
    Please Login or Register  to view this content.
    Regards,
    Antonio

  3. #3
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Selecting a range of columns based on a cell value

    Another option using an Input Box

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    01-20-2009
    Location
    newcastle
    MS-Off Ver
    Excel 365
    Posts
    59

    Re: Selecting a range of columns based on a cell value

    Woks a treat, thank you very much.

  5. #5
    Registered User
    Join Date
    01-20-2009
    Location
    newcastle
    MS-Off Ver
    Excel 365
    Posts
    59

    Re: Selecting a range of columns based on a cell value

    Thank you for the help Antonio

    Phil

+ 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. selecting cell range based on number in a different cell
    By tzvi in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-03-2015, 06:44 AM
  2. [SOLVED] Selecting a Range based on location of a cell
    By spcw in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-11-2014, 03:09 PM
  3. [SOLVED] Help with selecting a range based on the value of a cell
    By jaredj34 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-25-2014, 12:22 PM
  4. [SOLVED] Selecting a range except the last 2 columns
    By Excel432 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-23-2012, 10:09 AM
  5. [SOLVED] Hide columns based on cell value - Unable to set hidden range property of Range Class
    By trillium in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-13-2012, 11:13 PM
  6. Selecting a range based on cell value
    By alpha1980 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 10-26-2008, 07:19 AM
  7. Selecting and deleting named range based on cell value
    By Rich Kniatt in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-06-2006, 03:04 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