+ Reply to Thread
Results 1 to 1 of 1

Converting cell formulas to VBA Code

  1. #1
    Forum Contributor
    Join Date
    02-09-2011
    Location
    Perth, Australia
    MS-Off Ver
    2016
    Posts
    161

    Converting cell formulas to VBA Code

    Hi,

    I receive a spreadsheet from another department that shows Start and Finish dates for activities. I paste this sheet into my spreadsheet in a sheet called ‘PI & Data”. I need to lay out associated data such as Quantities and Manhours over a timeline (similar to a Gantt Chart). (And no, I can’t just use MS Project. It has to be Excel).
    When this started I was getting 49 rows of data so I just set up a worksheet for each combination of Area, Discipline and Cost Code and had a timeline across the top row ( a cell for each day with the date as the heading). In each cell I placed a formula that extracted the Quantity or Manhour (per day) from the source data by Area, Discipline and Cost Code. There were 49 rows that aligned with the 49 rows in the source data. The daily values were then rolled up into weekly values by summing along the bottom of the range. These weekly values are then referenced on another sheet called 110Figures.
    So there was a sheet for Area 110A, Discipline ME and Cost Code 15.3xxx, for example. There are around a dozen of these sheets. The formula in each cell is:

    =IF(AND('PI & Data'!$C2="ME", D$3>='PI & Data'!$F2, D$3<='PI & Data'!$G2,'PI & Data'!$H2=19.913,(LEFT('PI & Data'!$B2,4)="110A")), 'PI & Data'!$K2, " ")

    If I had 4 instances where the combination 110A, ME and 15.3xxx occurred I would have 4 rows populated in that sheet and the remainder empty.
    This may have been clumsy but was the only way I knew to do this and it worked great. Problem is the source data now runs to 400 or more rows! It is obviously not practical for me to have 400 rows of formulas in each of my sheets.
    Can I do the same thing, using VBA I guess, where I only get 4 rows returned if there are 4 matches in the source data and I don’t have all these cells full of formulas? I still need to roll the daily values up to weekly and use those weekly values on other sheets.
    What would the code be?
    I will attempt to attach a sample file (with most sheets deleted to reduce file size).

    Thank you very much

    Dave
    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. [SOLVED] Importing formulas/code from one cell to another, to affect multiple cells.
    By AirSteward in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 03-07-2014, 12:43 PM
  2. Macro code for copying formulas till the last non-empty cell
    By Zozika in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-28-2013, 08:47 AM
  3. Converting to Array formulas
    By monu_sonu in forum Excel General
    Replies: 2
    Last Post: 11-23-2012, 07:20 AM
  4. i have an sFind Code that erases formulas in cell...
    By Legend Rubber in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-16-2012, 09:44 AM
  5. [SOLVED] Help me in converting a formula in cell to a macro code
    By kishoremcp in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-05-2012, 06:19 AM
  6. Converting cell colors to hex code
    By DimlerJ in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-23-2007, 01:59 PM
  7. Converting formulas into numbers
    By kasio in forum Excel General
    Replies: 2
    Last Post: 11-01-2006, 07:29 PM
  8. delete some cell formulas and leave others using code
    By john tempest in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-23-2006, 11:55 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