Kód do Modulu:
Public bJeFarbene As Boolean
Public RNG As Range
Public Function UDF_Select_Oblast() As Range
Set UDF_Select_Oblast = RNG
End Function
Kód do udalosti listu
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Set RNG = Intersect(Selection, Range("B2:B109,E2:E109,H2:H109,K2:K109"))
If Not RNG Is Nothing Then
bJeFarbene = True: Calculate
ElseIf bJeFarbene Then
Set RNG = Nothing
Calculate
End If
End Sub
Vzorec do Podmieneného formátovania (pri označenej bunke B2):
=COUNTIF(udf_select_oblast();B2)>0
jeho rozsah
=$B$2:$B$109;$E$2:$E$109;$H$2:$H$109;$K$2:$K$109