PDA

View Full Version : [Excel] metodo Union (urgente)


guldo76
16-10-2004, 13:44
Potreste aiutarmi a capire come usare il metodo union?
Bisogna passargli dei Range come argomento, e non so come farlo cumulativamente. Mi spiego con un esempio:
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
Questa non funziona appunto perche' cerco di passare al metodo Union un argomento che e` una stringa, invece che un Range.
Come posso fare?!?

Grazie :)