+ Reply to Thread
Results 1 to 3 of 3

Updating a formula to include the last cell with a value.

  1. #1
    Registered User
    Join Date
    01-28-2010
    Location
    earth, milky way
    MS-Off Ver
    Excel 2010
    Posts
    47

    Updating a formula to include the last cell with a value.

    I'm trying to modify a formula to run down to the last cell with a value. If you open the attached spreadsheet, a sumproduct in cell D1 is currently running from A1:B6. This may change to any table size between columns A and B (where row 6 currently has the last set of values). I simply want to create a macro where the sumproduct formula will run from A1:BX where X is the last row there is a value.

    Let me know if you have any questions.

    If you are curious, I am trying to use this for the solver add-in. I can go into more details on that if need be.

    Thanks in advance.

    Solver.xlsx

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Updating a formula to include the last cell with a value.

    Try the attached.
    Attached Files Attached Files

  3. #3
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Updating a formula to include the last cell with a value.

    I understood you problem a bit different from what did AB33 so my macro works in another way.

    You enter the target value in cell F3, and then run macro "SolverRun".

    Macro checks the range with values in column A then "updates" the "SUMPRODUCT" formula in cell D3, clears the corresponding range in column B and launches solver.

    Instead of entering target value in solver I've used the setup where solver should minimize the value in cell H3.

    Before running this macro you must set a reference to solver in the "Visual Basic" window. Go to Tools -> References and tick box marked Solver.

    If not found click "Browse" and locate file "Solver.xlam" most likely found at "Microsoft Office\Office 14\Library\Solver\solver.xlam"

    Alf
    Attached Files Attached Files

+ 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. updating pivot table to include additional rows
    By Ellen in forum Excel General
    Replies: 4
    Last Post: 07-28-2014, 03:54 PM
  2. Updating a code to include the data above rows inserted
    By GAccounting in forum Excel Programming / VBA / Macros
    Replies: 26
    Last Post: 09-10-2010, 06:20 PM
  3. Automatically updating chart to include new column with VBA
    By Gary in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-28-2006, 03:55 PM
  4. Need help updating my macro to include a 2nd worksheet.
    By billrl34 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 12-09-2005, 04:06 PM
  5. Replies: 4
    Last Post: 02-03-2005, 05:06 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