+ Reply to Thread
Results 1 to 6 of 6

Adding formulas to dynamic non-rectangle range

  1. #1
    Registered User
    Join Date
    09-08-2018
    Location
    Kamloops, Canada
    MS-Off Ver
    Office 365
    Posts
    86

    Adding formulas to dynamic non-rectangle range

    I have a very intricate and large data set that is dynamic (pulls charges for a large project per month and task). I need to add formulas using a macro to the set. I have done this easily for a rectangle shaped range. However, now I need to do it for a range that is not rectangle. There are two identifying factors (one in the rows and one in the columns) that I can use to define where to input the formulas but I don't know how to do this.

    I was going to do the
    Please Login or Register  to view this content.
    loop to get some of it to work. I was going to do this from Planned Value down to the first month in column F. But then, I need do add the formula in the Total row (which is dynamic) all the way to column AZ. I don't know how to do this.

    Here's my code right now, which puts it in F10:AZ200. However, I don't want the formula in the months after Planned Value for each task. So where I've put a red line around is where I want it. But the Total row can change and so can the Planned Value.

    Please Login or Register  to view this content.
    So how do I get it to put the formula from the first month to Planned Value, then down to Total, and across the Total row to AZ?

    Thanks in advance.
    Attached Images Attached Images

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Adding formulas to dynamic non-rectangle range

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    09-08-2018
    Location
    Kamloops, Canada
    MS-Off Ver
    Office 365
    Posts
    86

    Re: Adding formulas to dynamic non-rectangle range

    Thanks so much, AlphaFrog. This looks great. However, I get the following error when I run it. Do you know why that might be? I have my code on the sheet specifically, not a module.
    Attached Images Attached Images

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Adding formulas to dynamic non-rectangle range

    The error is because it cannot find "Planned Value" in row 9. Can you attach an example workbook?

  5. #5
    Registered User
    Join Date
    09-08-2018
    Location
    Kamloops, Canada
    MS-Off Ver
    Office 365
    Posts
    86

    Re: Adding formulas to dynamic non-rectangle range

    Hi AlphaFrog. I figured it out.

    The "Planned Value" is put there through a formula, not as text. When I changed it to manual entry to test, everything worked fine. Is there a way around this?

    The code right now for "Planned Value" is this
    Please Login or Register  to view this content.
    The code for "Total" is this
    Please Login or Register  to view this content.
    Thanks for your help.

  6. #6
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Adding formulas to dynamic non-rectangle range

    Quote Originally Posted by PingTing View Post
    The "Planned Value" is put there through a formula, not as text. When I changed it to manual entry to test, everything worked fine. Is there a way around this?
    Please Login or Register  to view this content.

+ 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. VBA adding rectangle shape with conditions (production plannification using)
    By hunker in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-30-2020, 01:44 PM
  2. Pick rectangle from list that is larger than other rectangle and minimize area.
    By jgwentworth96 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 02-05-2020, 01:57 PM
  3. [SOLVED] How to fit rectangle with big size in a middle of a range
    By gaului in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-04-2017, 07:12 PM
  4. Insert cells, fill formulas down, set formulas for dynamic range
    By Snickers65 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-03-2013, 01:43 PM
  5. Adding a colored shape (rectangle) to a footer
    By tommyfernandez in forum Excel General
    Replies: 2
    Last Post: 12-19-2012, 02:34 PM
  6. Adding a dynamic range to formulas
    By sans in forum Excel General
    Replies: 20
    Last Post: 12-07-2011, 10:55 AM
  7. [SOLVED] Code to get a Range RECTangle or PT
    By keepITcool in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-12-2005, 02:05 PM

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