+ Reply to Thread
Results 1 to 5 of 5

How to copy a cell range based on an individual cell

  1. #1
    Registered User
    Join Date
    03-15-2014
    Location
    Peterborough, England
    MS-Off Ver
    Excel 2007
    Posts
    2

    How to copy a cell range based on an individual cell

    Good afternoon to you all. I am really hoping that someone can help me as my brain has now shut down.

    I have a spreadsheet (book1.xls) that has a column with 13 names down the side and 31 other rows (dates of the month)

    Mike1 1 2 3 4 5 6 7 8 9
    Mike2 1 2 3 4 5 6 7 8 9
    Mike3 1 2 3 4 5 6 7 8 9
    Mike4 1 2 3 4 5 6 7 8 9 etc

    I have selected all 13 rows and 7 days and named them 'week1', and the next 7 days 'week2', the next 7 days 'week3' etc
    What i want is to display the named range based on a single cell selection based on a cell value in a different sheet.

    The basics of it should be "If cell C1 = 1 then show me 'week1' or if cell C1 = 2 then show me 'week2' etc.
    There has to be an easy way to do this but my brain has leaked out of my ears and now i'm struggling so any help would be hugely appreciated.
    Thanks in advance for helping a braindead noob.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: How to copy a cell range based on an individual cell

    do you mean something like this?
    Attached Files Attached Files
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: How to copy a cell range based on an individual cell

    Hi,

    Difficult to comment without seeing the workbook, but if I understand the requirement you'd be better off adding an adding an additional column that contains the week reference, preferably a date I suggest since you can then perform date arithmetic should that be necessary. Once you have this additional column then it's a trivial task to filter it.

    Naming ranges is good practice, don't get me wrong, but on this occasion I don't believe they bring anything to the party. You could use them I suspect in a macro which identified the range name in question and hid all the other ranges, but that's I suggest a more convoluted way.

    The other option would be to use the Custom Views functionality whereby you manually filter what you want to see for each week and add it as a custom view name. But you'd still need a macro to detect the view and then set it.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: How to copy a cell range based on an individual cell

    Hi Merlin and welcome to the forum.

    It sounds like you want the following. Change the value in cell A1 to the week number you want to view and see what happens. The code looks like:
    Please Login or Register  to view this content.
    Attached Files Attached Files
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  5. #5
    Registered User
    Join Date
    03-15-2014
    Location
    Peterborough, England
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: How to copy a cell range based on an individual cell

    Quote Originally Posted by martindwilson View Post
    do you mean something like this?
    Oh yes Martin. I absolutely mean exactly that. You have no idea how much that's helped me.
    Thanks again

+ 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. Copy cell range to another workbook based on a value
    By Sassyponypants in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-04-2013, 09:37 AM
  2. [SOLVED] Count Occurrence Of Text Within Individual Cell And Cell Range
    By jhudson444 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-06-2013, 09:06 PM
  3. [SOLVED] Query Oracle using range in Excel to return individual records for each cell in range
    By bigwillydier in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-18-2013, 06:37 PM
  4. [SOLVED] Copy data from a range of cells into a blank range based on common cell
    By vanmeterkj in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-03-2012, 10:18 AM
  5. Copy a range based on a cell value
    By tuke016 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-29-2011, 10:46 AM

Tags for this Thread

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