
Originally Posted by
DocAElstein
From Wednesday 10 September until Sunday 14 September there was an insane number of Unknown Location s
.....
.....
From Wednesday 10 September until Sunday 14 September there was an insane number of
Unknown Locations seen in
UnknownLocations worksheet of file,
https://i.postimg.cc/k47Cj883/Insane...-September.jpg
……
…………
, - - - Time to do a quick macro to get an ordered list of those IPs getting "lost" in
Unknown Location - - -
So, …. way back, at about a third the way into September, the UnknownLocations were at a level probably not seen before , or at least I had not noticed …
So I want a quick way of getting the ordered list of what fucking bots I managed to get fucked into a hole. Then I can decide whether to fuck them, or train them into my Beast of Burden, ( then I can eat them, or fuck them, or both, as it suits me)
OK, here we go, after a kip and thinking about it
Now,
This is what we start with
(It is worksheet UnknownLocations in the "Dailys" file SummaryRequestsIPsDailys.xlsm )
https://i.postimg.cc/wxfpQXCP/Unknow...ailys-File.jpg

_ There could be a trend in some or all rows, or one or more high viewed Unknown Location , or some combination. In other words I might want to look at a row or a few of rows together/ consolidated…
Here is an idea. It comes about from a not so well known "multi in Line cell selection copy phenomena"
The general Multi-Cell Selection possibility is not so well known, (perhaps as the use of it without VBA is limited).
I can for example select a cell, then hold down the Ctrl key and select randomly a few more. I end up then with them all selected! ( You can prove that by trying it and then taking a look at what you get returned in VBA for a command like
Selection.Cells.Count )
Similarly I can do a For Each __ Next on all the cells in a selection. So that is the basis for the coding
I will use this couple of Cell example
https://i.postimg.cc/zDsfW94H/2-Cell...-Selection.jpg

There are multiple IP addresses in the cell, as there could often be, and I think I know what the format for how they are joined/ separated from this code section ( From coding Sub GetRefreshesIPAddressWatchingThingsAtExcelFox() in worksheet Requests code module of file IPAddressesWatchingExcelFox_Refresh.xls )
Code:
Else
Let rngReqErrIn = Request
Let rngReqErrIn.Offset(0, -1) = rngReqErrIn.Offset(0, -1).Value + 1
Let rngReqErrIn.Offset(0, 1) = rngReqErrIn.Offset(0, 1).Value & vbCr & vbLf & " " & IPAddress
End If
End If ' Finished with problem requests here
But a check will not do any harm ….
It was a good idea that I did that, as it reminded me that I sometimes have an extra vbTab or two
Looking at the example 2 cell non contiguously selection of the last screenshot, I have text something like this
Code:
"170.247.84.197
170.247.84.197 "
"138.219.220.244
138.219.220.244 "
( I am not t always sure why I get some "s sometimes on a paste. I will have to think about that again some other time
This coding gets me the results below after manually doing the two non contiguously cell selection of the last screenshot
Code:
Sub MultiCellsSelection()
Dim rCel As Range
For Each rCel In Selection
Debug.Print
Debug.Print rCel.Value2
Call WtchaGot_Unic_NotMuchIfYaChoppedItOff(rCel.Value2)
Debug.Print
Next rCel
End Sub
Code:
170.247.84.197
170.247.84.197
"170.247.84.197" & vbTab & vbCr & vbLf & " 170.247.84.197" & vbTab
138.219.220.244
138.219.220.244
"138.219.220.244" & vbTab & vbCr & vbLf & " 138.219.220.244" & vbTab
So the next basic code idea will get us a simple 1 dimensional array of the IP addresses
Code:
Sub MultiCellsSelectionConglomerates()
Dim rCel As Range, CelIPs As String, IPs As String
For Each rCel In Selection
Let IPs = IPs & rCel.Value2 & " " ' Biuld up the final string. - Multiple IP values in the cell (rCel) are already seperated by a " " , so the " " here adds another so that finally all IP valus are seperated by a " "
Next rCel
Let IPs = Replace(IPs, vbTab, "", 1, -1, vbBinaryCompare) ' I will likely have a lot of vbTab that I do not want
Let IPs = Replace(IPs, vbCr & vbLf, "", 1, -1, vbBinaryCompare) ' I have a vbCr & vbLf between multi values in a cell and I do not want them
Let IPs = Trim(IPs) ' The above loop put an extra last " " on which I do not need
Dim arrIPs() As String: Let arrIPs() = Split(IPs, " ", -1, vbBinaryCompare) ' Finally I have a string delimited by " " , and hopefully as it is a string and I make a string element array here, we will not have any problems yet of IP addresses getting messed up by trailing 0s getting lost somewhere
End Sub
Bookmarks