View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Guldo K Guldo K is offline
external usenet poster
 
Posts: 9
Default selection by values

"Frank Kabel" writes:

Hi
AFAIK you have to use FIND statements and may use Union to create a
range of these cells


Thanks. That looks just like what I needed :)
.... but I can't understand properly how to use it...
It needs Ranges as arguments, so strings do not fit.

Here's a piece of code:
'''START
Sub macro()
UNIONE = ""
NOME = "whatever"
With Sheets("foglio1").Columns(3)
PRIMO = .Find(NOME, LookIn:=xlValues, lookat:=xlWhole).Address
SUCCESSIVO = PRIMO
Do
SUCCESSIVO = .FindNext(Range(SUCCESSIVO)).Address
UNIONE = UNIONE & "Range(" & Chr(34) & SUCCESSIVO & Chr(34) & "),"
Loop Until SUCCESSIVO = PRIMO

UNIONE = Left(UNIONE, Len(UNIONE) - 1)

Union(UNIONE).Select
End With
End Sub
'''END

So, how can I pass Ranges to Union inside a loop?

Thank you.
--
Guldo