'change cell event macro
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
With Sheets("Pricing")
Set rng = Range(.Cells("3", "D"), .Cells("17", "D")) 'note leading periods/fullstops
End With
If Not Intersect(rng, Target) Is Nothing Then
Call OverlapCalculator
Call CalculateDrops
Call CalculatePrice
End If
End Sub
Function getPVCRow()
Dim pvc As String
pvc = Worksheets("Pricing").Range("D8").Value
If pvc = "" Then
MsgBox ("Please select a PVC type before continuing")
End If
'got value now we need to find the right bracket and the number of notches associated with this
'first find the value in the B column
getPVCRow = Worksheets("Costs").Columns(2).Cells.Find(what:=pvc, After:=ActiveCell, LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False).Row
End Function
Sub OverlapCalculator()
'
' OverlapCalculator Macro
'
' First of all we need to find out strip width from the selected dropdown box
' Next we need to then check the number of notches on the bracket
' Finally we can calculate and add the values to the dropdown
Dim selectedrow As Integer
selectedrow = getPVCRow
|