selection by values

  • Thread starter Thread starter Guldo K
  • Start date Start date
G

Guldo K

Hello everybody.

I'd like to perform a selection by values. I mean, I have to detect,
into a given column, which cells have a certain value. I'd be happy if
I could get a range object or something with the resulting cells.

I could perform many 'Find' commands, adding the cell address to a
string on each 'Find' result, but that does not look that efficient.
I wish that 'SpecialCells' could be used, but it doesn't look
feasible, am I wrong?
Is there a better way?

Thank you.
 
Hi
AFAIK you have to use FIND statements and may use Union to create a
range of these cells
 
Frank Kabel said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top