Hi guys!
Long time reader, first time poster :D
I've created a quote calculator for our company and having trouble getting costs for a specific products summed up into one cell. I'm trying to write a formula in excel VBA to sum specific values from different worksheets. I have 2 different tables i want to sum from. Additionally i'm running the formula through a FOR loop depending on the amount of products.
For the first sheet "Additional Equipment" i can easily get the specific cell simply by multiplying i, because all tables are of equal size. For the sheet "Addtitional Equipment Labor" things are a little bit more complicated and i can't get to the correct cell by multiplying i.
Earlier in the code i have made and object variable "add_equipment_labor_information". This variable has 6 different ranges in it. The ranges refer to the tables on the sheet.
My question is: Can i use the object variable inside the Formula and how to do it, if possible. Currently it returns a type mismatch error.
Thanks for the help!
Long time reader, first time poster :D
I've created a quote calculator for our company and having trouble getting costs for a specific products summed up into one cell. I'm trying to write a formula in excel VBA to sum specific values from different worksheets. I have 2 different tables i want to sum from. Additionally i'm running the formula through a FOR loop depending on the amount of products.
Code:
For i = 1 To 6 'Getting total costs for additional equipment
If x_num_addequip = 1 Then Exit For 'x_num_addequip is a value returned by a dropdown list (1 = 0)
sheetname = "'Additional Equipment'!"
financial_information(8).Cells(i + 2, 2).Formula = "=" & sheetname & Cells(i * 22, 5).Address(False, False) & "+" & add_equipment_labor_information(i) & Cells(24, 5).Address(False, False) & "+" & add_equipment_labor_information(i) & Cells(37, 5).Address(False, False) 'addititional equipment 1-6 total cost
Next i
For the first sheet "Additional Equipment" i can easily get the specific cell simply by multiplying i, because all tables are of equal size. For the sheet "Addtitional Equipment Labor" things are a little bit more complicated and i can't get to the correct cell by multiplying i.
Earlier in the code i have made and object variable "add_equipment_labor_information". This variable has 6 different ranges in it. The ranges refer to the tables on the sheet.
My question is: Can i use the object variable inside the Formula and how to do it, if possible. Currently it returns a type mismatch error.
Thanks for the help!