Hi I am wondering whether you could help me with an excel formulae. I will need to send the excel sheet to you as it is a little complicated.
see excel file
how to creat userform with below formulae :
Private Sub cboCat_Change()
Dim rngCP As Range
Dim c As Range
Dim cbC As String
Dim cbP As String
Dim bKeep As Boolean
On Error Resume Next
Set rngCP = ThisWorkbook.Names("CatProd").RefersToRange
Debug.Print rngCP.Address
If Not Me.cboCat Is Null Then
cbC = Me.cboCat.Value
End If
If Not Me.cboProd Is Null Then
cbP = Me.cboProd.Value
End If
With Me.cboProd
.Clear
For Each c In rngCP
If c.Value = cbC Then
.AddItem c.Offset(0, 2).Text
.List(.ListCount - 1, 1) _
= c.Offset(0, 1).Text
If c.Offset(0, 2).Text _
= cbP Then
bKeep = True
End If
End If
Next c
If bKeep = True Then
.Value = cbP
End If
End With
End Sub
Bookmarks