0
I’m building some functions to analyze an IP table. I just used VBA for the first time in my life and in my research I found nothing that could help me.
I need to create a function that looks for the smallest missing number in an Excel column. The user must pass the initial and final value, for example 5777 and 6287. The function should search in the predetermined column (which will be sorted) between these indexes and, when finding a non-existent index, inform the user.
These indexes represent a transformation in the IP and the interval between them represents a subnet. When it returns me the lowest available index, the inverse transformation will show me the lowest free IP in that range.
I know I could create iterations from the initial index and with each iteration compare the index with all available indices. Only this would require two iterations and in case there are no addresses available, it would do n (m = Qtd of Ips used across the network and n = Ips quantity in the subnet). That for a 512 IP subnet would be an absurd number of iterations.
Would there be some other way to do this without putting too much strain on the execution of the code?
I didn’t understand the "when finding a non-existent index, informing the user." part, could explain better what I meant?
– Math
The index is nothing more than a more "computable" IP. One of the problems I have is that Ips are dispersed within the subnet interval. This makes management very difficult. The purpose of this function is to make the new machines cover the holes by assuming smaller Ips. That is, I want to increase the concentration of machines at the beginning of the interval. ?
– dxtr_brz
To illustrate, one of the subnets here has 510 addresses, in theory. I use only 246 of them. The machines should concentrate in the first half and so it would be easy to find a free address: it would always be the last used +1. In my current situation, the coaches think up a number and kick until they get it right. Since I can’t force the technician to do a search for the smallest IP available (it would take a long time), I want the system to indicate the best address for it. That way, in some time, we will have the ideal situation of Ips being in a continuous interval.
– dxtr_brz
If I understood correctly, in theory, you wouldn’t even need to use VBA for this. If no more pronounce, later put a "possible" solution to the proposed problem.
– Oneide
Don’t wait no, I need it with a certain urgency.
– dxtr_brz