
Originally Posted by
PcMax
Thanks for the suggestions, I ask if there are alternatives in the event of non-adjacent columns.
I tried to change the range of research, but I can not use the method ..
Code:
Riga = Columns("A:C", "G").Find
ashu1990 gave you the correct syntax to use... Range("A:C,G:G") instead of Columns("A:C","G") because Columns cannot take non-contiguous ranges for its argument... however, you cannot use non-contiguous ranges with the Find function (well, you can, but it will end up finding a value in the last area of the non-contiguous range first and not look at the other areas making up the non-contiguous range, so you will not always get the correct answer doing so). I think you are back to your Max-method, but I would write it as a loop so that it is more flexible...
Code:
Dim Riga As Long, Ar As Range
For Each Ar In Range("A:C,G:G")
Riga = Application.Max(Riga, Ar(Ar.Count).End(xlUp).Row)
Next
MsgBox Riga
Bookmarks