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
Bookmarks