+ Reply to Thread
Results 1 to 4 of 4

Code that grabs a dynamic range from a cell

  1. #1
    Forum Contributor
    Join Date
    10-24-2012
    Location
    Chicago
    MS-Off Ver
    O365
    Posts
    311

    Code that grabs a dynamic range from a cell

    Hello,

    I have a file of data with sales information. A test is run over the data. Adjacent to the test I have an Address formula that gives me a result of a tab name and a range. It does this on any row that fails the test. This range in column DL is telling me where I need to go in the data and cut that range out of the data. The range in DK is telling me where I need to paste that cut data too. I need code that will loop through and skip over the blanks (data that passed the test) and perform the action of cut and paste on the ranges specified in each row of data that failed the test. I am having a hard time getting the code to use the value in the cell as the range. Any help would be appreciated.

    this code below goes through and cuts the data in cell DL and pastes it to DK. That isn't exactly how I want this to work. I want it to use the range in the cell as the location to go cut and use the range in the adjacent cell as the range to go paste to.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  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: Code that grabs a dynamic range from a cell

    It appears all your code is doing is copying the values down from the row above, correct? If so, try this:

    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 Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: Code that grabs a dynamic range from a cell

    from the description it seems to me that
    Please Login or Register  to view this content.
    shall do.
    Of course instead of concatenating opening ' with the content of the cell, you can use split and replace to properly construct sheets() and range() references as above.
    Best Regards,

    Kaper

  4. #4
    Forum Contributor
    Join Date
    10-24-2012
    Location
    Chicago
    MS-Off Ver
    O365
    Posts
    311

    Re: Code that grabs a dynamic range from a cell

    Thanks JB! It worked the way we wanted it to. I appreciate the help.

    Kaper I didn't try yours but I will once I get a chance.

+ 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] VBA code for Dynamic range
    By Srikanth H N in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-03-2014, 11:22 PM
  2. [SOLVED] Need help with Dynamic Range in my code.
    By moonsaga in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-14-2014, 01:08 PM
  3. How can I fix the below code for establishing a dynamic range?
    By xcelnovice101 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-09-2013, 03:16 PM
  4. How do i reference a dynamic cell range in VBA code
    By alice03 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-08-2013, 10:56 AM
  5. VBA code for dynamic name range
    By weii in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-12-2007, 07:36 PM

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