Hi guys,
Im kind of beginner in vba.
Below is a simple udf.
If two criteria match it will return with the value from the WorksheetFunction.Index(Sheets("TP_IP_range").Range("C:C"), add, 0).
I would like to change the value of Worksheets("TP_IP_range").Range("B" & add"). Is it possible somehow??
Function tp_ip()
Dim add As Integer
Dim start As Integer
Dim rng As Range
Dim ip As String
start = 0
Set rng = Workbooks("Ran_ports_master.xlsm").Worksheets("TP_IP_range").Range("E:E")
Do
add = WorksheetFunction.Match("-", rng, 0)
add = add + start
ip = WorksheetFunction.Index(Sheets("TP_IP_range").Range("C:C"), add, 0)
If WorksheetFunction.Index(Sheets("TP_IP_range").Range("A:A"), add, 0) <> "" Then
start = add
add = add + 1
Set rng = Worksheets("TP_IP_range").Range("E" & add & ":E17000")
Else
tp_ip = ip
Exit Do
End If
Loop
End Function
thanks in advance
Im kind of beginner in vba.
Below is a simple udf.
If two criteria match it will return with the value from the WorksheetFunction.Index(Sheets("TP_IP_range").Range("C:C"), add, 0).
I would like to change the value of Worksheets("TP_IP_range").Range("B" & add"). Is it possible somehow??
Function tp_ip()
Dim add As Integer
Dim start As Integer
Dim rng As Range
Dim ip As String
start = 0
Set rng = Workbooks("Ran_ports_master.xlsm").Worksheets("TP_IP_range").Range("E:E")
Do
add = WorksheetFunction.Match("-", rng, 0)
add = add + start
ip = WorksheetFunction.Index(Sheets("TP_IP_range").Range("C:C"), add, 0)
If WorksheetFunction.Index(Sheets("TP_IP_range").Range("A:A"), add, 0) <> "" Then
start = add
add = add + 1
Set rng = Worksheets("TP_IP_range").Range("E" & add & ":E17000")
Else
tp_ip = ip
Exit Do
End If
Loop
End Function
thanks in advance