+ Reply to Thread
Results 1 to 3 of 3

Deciphering VBA

  1. #1
    Registered User
    Join Date
    02-01-2017
    Location
    U.S.
    MS-Off Ver
    2010
    Posts
    2

    Deciphering VBA

    Short and sweet... I am trying to decipher the VBA from an existing macro and add more functionality into it. The current macro we use changes the names in two columns from our excel sheet based on their Length and Width values using an if statement shown below.

    I am trying to build a rule to read the thickness value of a Material named "Black Laminate" instead of the "Plywood STD" it currently reads. The name should be changed based on the "Thick" value to read as one of the following options:
    LAM-BLK 1/4 4X8FT if "Thick" = .25
    LAM-BLK 3/8 4X8FT if "Thick" = .375
    LAM-BLK 1/2 4X8FT if "Thick" = .5

    See the images at the bottom showing how the current string alters our Plywood names and the other image showing what I need it to do now. I have little understanding of VBA - Can I assume copying this string and changing a few names will do the trick? I have already updated the macro to discover the values from the new "Thick" column and I am just looking how to properly rewrite this rule below.

    foreach (var r in bom.Rows.Where(x => x.Material != null && x.Material.IndexOf("Plywood Std", StringComparison.OrdinalIgnoreCase) >= 0))
    {
    double l;
    double w;
    string plywoodDesc = "";

    if (r.Length != null && double.TryParse(r.Length, out l) && l > 95.5)
    {
    plywoodDesc = "PLY-STD 3/4 4X10FT";
    }
    else if (r.Width != null && double.TryParse(r.Width, out w) && w > 47.5)
    {
    plywoodDesc = "PLY-STD 3/4 5X8FT";
    }
    else
    {
    plywoodDesc = "PLY-STD 3/4 4X8FT";
    }

    r.PartNumber = plywoodDesc;
    r.StockSize = plywoodDesc;
    }

    CURRENT PROCESS.png
    END GOAL.png

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Deciphering VBA

    Welcome to the board.

    I don't know what language that is (C#?), but it's not VBA.
    Last edited by shg; 02-01-2017 at 12:21 PM.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    02-01-2017
    Location
    U.S.
    MS-Off Ver
    2010
    Posts
    2

    Re: Deciphering VBA

    ...and the plot thickens...

+ 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. Function deciphering...
    By EXCEL40294 in forum Excel General
    Replies: 3
    Last Post: 06-09-2015, 03:14 PM
  2. [SOLVED] Help deciphering formula
    By bdouglas1011 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-21-2014, 05:01 PM
  3. Deciphering a formula
    By mwatt05 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-02-2014, 02:47 PM
  4. [SOLVED] Help Deciphering formula?
    By bbecht01 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 11-14-2013, 10:30 PM
  5. Deciphering a Formula
    By Winstonwolf in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-29-2012, 04:05 PM
  6. Another one i need deciphering...
    By Dan Mackman in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-26-2007, 06:04 PM
  7. Deciphering two formulas
    By tylerpat7 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-28-2005, 04:59 PM

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