+ Reply to Thread
Results 1 to 9 of 9

Using range in a macro from cell value

  1. #1
    Registered User
    Join Date
    02-13-2015
    Location
    Baltimore, MD
    MS-Off Ver
    Excel for Mac 2011
    Posts
    43

    Using range in a macro from cell value

    Hi all.

    I am currently running a macro that takes the top 25 lines from one tab and moves to another. Problem is, sometimes I need that 25 to be a smaller or greater number. Currently I am using:


    Please Login or Register  to view this content.


    And it works great. Can I use the cell value to change the "B25" above to read something like :


    Please Login or Register  to view this content.

    So it would pull the number from cell Q2 on the results tab and today for instance, it would pull the top 11 lines,

    Thanks for the help!!

    Chris
    Last edited by ckserra; 11-02-2017 at 08:55 AM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,705

    Re: Using range in a macro from cell value

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Click on Edit to open your thread, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    02-13-2015
    Location
    Baltimore, MD
    MS-Off Ver
    Excel for Mac 2011
    Posts
    43

    Re: Using range in a macro from cell value

    Done! Thanks Alan!

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,705

    Re: Using range in a macro from cell value

    Try this
    Please Login or Register  to view this content.
    or more efficiently

    Please Login or Register  to view this content.

  5. #5
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Using range in a macro from cell value

    Or simply:
    Please Login or Register  to view this content.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  6. #6
    Registered User
    Join Date
    02-13-2015
    Location
    Baltimore, MD
    MS-Off Ver
    Excel for Mac 2011
    Posts
    43

    Re: Using range in a macro from cell value

    Ok. I missed an important piece of info. The tab that the X value it on is a different tab, named "Final".

  7. #7
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,705

    Re: Using range in a macro from cell value

    Please Login or Register  to view this content.

  8. #8
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Using range in a macro from cell value

    Then:
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    02-13-2015
    Location
    Baltimore, MD
    MS-Off Ver
    Excel for Mac 2011
    Posts
    43

    Re: Using range in a macro from cell value

    Perfect!! Thanks for the help guys!!

+ 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. Macro to find text from a range in another range and fill a cell accordingly
    By aspadaro in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-28-2017, 09:05 AM
  2. [SOLVED] Macro Delete Contents in 23rd corresponding cell if the cell in range is a non-blank cell
    By murtaza.khan in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-04-2014, 01:11 AM
  3. macro to find text string in cell range and paste in other cell range
    By slearner1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-05-2013, 11:15 AM
  4. RE:- Write Macro to copy a 2 cell range to another 2 cell range down the columns
    By Eire001 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-02-2013, 11:48 PM
  5. Change range of cells within VBA macro and copy and paste to fixed cell range
    By Mannyny in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-20-2012, 11:51 AM
  6. [SOLVED] Highlight range of cells - run macro - select last cell in range
    By chromachem in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-24-2012, 11:46 AM
  7. Macro code to change cell range to named range
    By Orlic in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-25-2008, 11:51 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