+ Reply to Thread
Results 1 to 15 of 15

adjusting vba code to make it dynamic as rows data rows differ

  1. #1
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    adjusting vba code to make it dynamic as rows data rows differ

    How to make column AD ,W ,J,,K,L dynamic in vba the data always starts at row 2.

    Actually lock at row 915 , but if data goes to row 1500 or 20000 or 50

    how to adjust code below






    Please Login or Register  to view this content.

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: adjusting vba code to make it dynamic as rows data rows differ

    Maybe like this?
    Please Login or Register  to view this content.
    BSB

  3. #3
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    Re: adjusting vba code to make it dynamic as rows data rows differ

    Hello
    Trying did not give me expected results .

    Take same file as dummy report sheet have 195 rows and customer A sheet have 915 rows of data .

    But I noticed it is taking Report Sheet to count , instead of Customer A sheet, thus having 195 rows instead of 915 rows



    Please Login or Register  to view this content.
    I think there is an issue on the lines below

    Please Login or Register  to view this content.
    Last edited by JEAN1972; 11-26-2018 at 01:55 PM.

  4. #4
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: adjusting vba code to make it dynamic as rows data rows differ

    Yes change

    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    May also need to change the "C" to another column if C does not always have data in every row.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  5. #5
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    Re: adjusting vba code to make it dynamic as rows data rows differ

    Better now thanks but a little issue on report sheet I am getting 0 up to row 911.

    the 911 rows of data are found on Customer Sheet A .

    Row 195 is furniture on Report sheet
    Attached Images Attached Images

  6. #6
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: adjusting vba code to make it dynamic as rows data rows differ

    I suggest you attach a sample workbook if the below code still doesn't do it... but yes I missed that the range was extended and it wasn't just the LR calculation This should help some:

    Please Login or Register  to view this content.
    Last edited by Arkadi; 11-26-2018 at 02:39 PM.

  7. #7
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: adjusting vba code to make it dynamic as rows data rows differ

    Any particular reason you're using SUMPRODUCT over SUMIFS ? Running a few thousand SUMPRODUCTs isn't going to be particularly quick regardless.

  8. #8
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    Re: adjusting vba code to make it dynamic as rows data rows differ

    Tried but still unsuccessful.

    Attached the formula version
    Attached Files Attached Files

  9. #9
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: adjusting vba code to make it dynamic as rows data rows differ

    Please Login or Register  to view this content.

  10. #10
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,192

    Re: adjusting vba code to make it dynamic as rows data rows differ

    Perhaps...
    Please Login or Register  to view this content.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  11. #11
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    Re: adjusting vba code to make it dynamic as rows data rows differ

    Sintek

    Not getting expected results as below , however for column AD, the results are corrects


    Please Login or Register  to view this content.

  12. #12
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,192

    Re: adjusting vba code to make it dynamic as rows data rows differ

    Hey there Jean...Upload a sample file with expected result so guys can compare ....

  13. #13
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,518

    Re: adjusting vba code to make it dynamic as rows data rows differ

    JEAN1972,

    Try
    Please Login or Register  to view this content.

  14. #14
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    Re: adjusting vba code to make it dynamic as rows data rows differ

    Hello Sintek

    as per post 8 attached sample file , should read cells y instead of w typo error.


    Jindon & Xlent worked .thank you a lot


    Please Login or Register  to view this content.

  15. #15
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,518

    Re: adjusting vba code to make it dynamic as rows data rows differ

    You are welcome and thanks for the rep.

    I think my cell reference was wrong...

    Anyway, if that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

+ 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. Adding rows to data --> filter not adjusting
    By Agame in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 06-01-2016, 08:44 AM
  2. [SOLVED] Need help adjusting VBA code to delete rows across all worksheets
    By jts5814 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-20-2016, 03:39 AM
  3. [SOLVED] Help Adjusting VBA Code Work On New Rows
    By avendi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-30-2015, 07:21 PM
  4. Can't make number of rows in table dynamic
    By zack22 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-10-2015, 12:30 AM
  5. Deleting rows that differ in certain columns
    By mremmenga in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-07-2008, 05:35 AM
  6. Replies: 3
    Last Post: 02-13-2008, 06:28 PM
  7. Compare Rows in 2 columns and count those that differ
    By Tim3057 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-15-2007, 08:58 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