Function getting into my Subroutine.

JOSEJUNIOR0021

New Member
Joined
Apr 24, 2016
Messages
2
Hello guys,


I have a little problem that I could find solution anywhere. and I bet it must be a simple one.


I've created a few functions to deal with IPs.
For example, I have in one cell the IP 172.21.103.166 and I want to add or subtract on the last octet (.166)


what is been happening is, if I have the workbook with that function opened, and I create a subroutine in any other workbook, as I run my subroutine step by step with F8 to test what I'm doing, it "jumps" to that function by itself.


At some point on my subroutine, it jumps to the function, loops the function a few times, and returns to my subroutine.
No errors or any other kind of messages appear. And, as it happens so fast, if I just run my subroutine I's not noticeable. But when I'm checking it step by step it gets very annoying.




I do not use the function on the subroutine.


Bellow is the function in question and an example of a subroutine that faces this problem.


By the way, English is not my first language, so forgive me for any grammar mistakes.


Here is the function:


Function MUDAIP(ipsep As String, valor As Long)
Dim separaip() As String
separaip() = Split(ipsep, ".")


separaip(3) = separaip(3) + valor


MUDAIP = separaip(0) & "." & separaip(1) & "." & separaip(2) & "." & separaip(3)


End Function




Here is an example of subroutine:


Sub DELLINHAVAZIA()


Dim SITE, TX As String
Dim LIM1, LIM, A As Long


LIM = Cells(Rows.Count, 1).End(xlUp).Row
LIM1 = 1




Range("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete




For A = 10 To LIM


SITE = Cells(A, 1).Value
SITE = Left(SITE, 23)
SITE = Right(SITE, 14)
SITE = Trim(SITE)


TX = Left(Cells(A, 1).Value, 78)
TX = Right(TX, 5)
TX = Trim(TX)


If TX = "ATM" Then
Cells(LIM1, 10).Value = SITE
Cells(LIM1, 11).Value = TX
LIM1 = LIM1 + 1
End If


Next A
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Stand to be corrected, but any change in the sheet is liable to trigger a change and the function then fires to be evaluated
 
Upvote 0

Forum statistics

Threads
1,216,099
Messages
6,128,816
Members
449,469
Latest member
Kingwi11y

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top