I have created a UDF which is not updating when dependant cells are changed, My calculation is set to Automatic.
If I change cells b3 to k5, the UDF in L3 updates.
These values are dependant upon values in the Paint Table, however if these are changed the UDF's do not calculate
I have attached the spreadsheet to make it easier to understand my problem
Change the value in cell e18 from 10 to 100
Value in cell L3 shows 5.97, if you edit the cell and return, the cell calculates to 11.01
My final spreadsheet has about 400 rows in the Paint_Specs table, and 300 rows of date in the Paint Table
Appreciate any help you can give, any comments on my code would be greatly received also, as this is my first post :)
If I change cells b3 to k5, the UDF in L3 updates.
These values are dependant upon values in the Paint Table, however if these are changed the UDF's do not calculate
I have attached the spreadsheet to make it easier to understand my problem
Change the value in cell e18 from 10 to 100
Value in cell L3 shows 5.97, if you edit the cell and return, the cell calculates to 11.01
My final spreadsheet has about 400 rows in the Paint_Specs table, and 300 rows of date in the Paint Table
Appreciate any help you can give, any comments on my code would be greatly received also, as this is my first post :)
Code:
Option Explicit
Public Function Paint_X(Coat1 As String, Coat2 As String, Coat3 As String, Coat4 As String, Coat5 As String, dft1 As Long, dft2 As Long, dft3 As Long, dft4 As Long, dft5 As Long, Ctry As Integer)
On Error GoTo Error_1
Dim DFT_Std As Single
Dim PaintMatch As Integer
Dim ThinnerMatch As Integer
Dim m2_Std As Single
Dim Thinners As String
Dim Thinners_Cost As Single
Dim Cost As Single
Dim m2_System As Single
Dim System_Cost As Single
Dim Coat As String
Dim dft As Integer
Dim cycle
For cycle = 1 To 5
If cycle = 1 Then
Coat = Coat1
dft = dft1
End If
If cycle = 2 Then
Coat = Coat2
dft = dft2
End If
If cycle = 3 Then
Coat = Coat3
dft = dft3
End If
If cycle = 4 Then
Coat = Coat4
dft = dft4
End If
If cycle = 5 Then
Coat = Coat5
dft = dft5
End If
If Coat = "None" Then GoTo Error_2
If Coat = "" Then GoTo Error_2
PaintMatch = Application.Match(Coat, Range("paint_List"), 0)
DFT_Std = Application.Index(Range("paint"), PaintMatch, 2)
m2_Std = Application.Index(Range("paint"), PaintMatch, 3)
Thinners = Application.Index(Range("paint"), PaintMatch, 4)
ThinnerMatch = Application.Match(Thinners, Range("paint_List"), 0)
Cost = Application.Index(Range("paint"), PaintMatch, Ctry)
m2_System = DFT_Std / dft * m2_Std / 2
System_Cost = Cost * 1 / m2_System
Thinners_Cost = Application.Index(Range("paint"), ThinnerMatch, 5) * 1 / m2_System * 0.1
Paint_X = Paint_X + ((System_Cost + Thinners_Cost) * 1.4)
Next
Error_1:
Paint_X = "?"
Error_2:
End Function