+ Reply to Thread
Results 1 to 6 of 6

Macro Autofill Dynamic Range with Multiple Data Sets

  1. #1
    Registered User
    Join Date
    08-03-2010
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    8

    Smile Macro Autofill Dynamic Range with Multiple Data Sets

    Hi, everyone!

    I have researched for the past three days on this matter and have not discovered a post similar, so I'm deciding to just post a new thread and ask myself.

    I am attempting to use macro to autofill two different ranges in the same spreadsheet from the command of a button. Since my ranges can change in the amount of rows that have data, I would like it to autofill for a dynamic range. I have tried many different codes, and I have one that works, but it doesn't work exactly as I had hoped. Here is my information:

    Range 1 is from F4:J50. I currently only have data from F4:J15.
    Range 2 is from F54:J80. I currently only have data from F54:J60.
    (*I will never need more than 50 rows per range)

    This is the code that I have currently:

    Please Login or Register  to view this content.
    This code works perfectly except it stops at the end of Range 2. I need it to stop right before Range 2 and then start up again at the beginning Range 2. Is there any way that I can have the autofill stop at the end of each range, but still adjust to each dynamic range?

    I would post my spreadsheet, but I work for a government agency and it has classified information. If it would make it much easier for everyone, I can make an example spreadsheet using different data.
    I really appreciate your help, and I hope I have been clear.
    Thank you!
    Rae
    Last edited by AliveNThisMoment; 08-07-2010 at 03:48 PM.

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Macro Autofill Dynamic Range with Multiple Data Sets

    Yes, upload an example spreadsheet please.

  3. #3
    Registered User
    Join Date
    08-03-2010
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Macro Autofill Dynamic Range with Multiple Data Sets

    Alright, here's my sample spreadsheet. As you can see, Line 2 begins at Row 51. I am trying to have my first range (Line 1) autofill from F4:J4 to F50:J50 for only the lines that have data. I was able to get that working, but my problem was Line 2. The code that worked to autofill Line 1 was
    Please Login or Register  to view this content.
    I tried changing the range values to Line 2 data, but because this equation is counting all of column J, it doesn't seem to work. When I use the following code, it autofills up.
    Please Login or Register  to view this content.
    I would really love Line 2 to autofill down to F8:J80, as well as keeping Line 1 functioning.

    Thank you so much for your help!
    Rae
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    08-03-2010
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Macro Autofill Dynamic Range with Multiple Data Sets

    I'm really sorry. The demo sheet I posted has some graphs on it that were pulling from defined names, neither of which are working with the sheet I just posted. I removed the graphs, so the new spreadsheet should be a little easier to work with.

    I'm sorry!
    Rae
    Attached Files Attached Files

  5. #5
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Macro Autofill Dynamic Range with Multiple Data Sets

    Rae - try this. Not entirely sure what you are copying, but this may give you an idea of how to circumvent the issue of having two blocks of data.
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    08-03-2010
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Macro Autofill Dynamic Range with Multiple Data Sets

    YAY! haha You are amazing!! You just saved me so much time. I really really appreciate it. Thank you so much, Stephen.

    Rae

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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