You actually do not have to select tempR
With tempR 'do some stuff End With
Gord
On Wed, 31 Dec 2008 12:07:10 -0800, Gord Dibben <gorddibbATshawDOTca> wrote:
[Quoted Text] >Sub Find_Cells() > >Dim Cell As Range, tempR As Range > For Each Cell In ActiveSheet.UsedRange > 'edit the range to suit or just Selection > If Cell.Value <> "Bye" Then > If tempR Is Nothing Then > Set tempR = Cell > Else > Set tempR = Union(tempR, Cell) > End If > End If > Next Cell > If tempR Is Nothing Then > MsgBox "There are no cells " & _ > "in the selected range." > End > End If > > tempR.Select >End Sub > > >Gord Dibben MS Excel MVP > >On Wed, 31 Dec 2008 09:42:19 -0800, Guy <Guy[ at ]discussions.microsoft.com> >wrote: > >>I have been trying to get a "IF" macro to work for this but am having trouble >>figuring out how to select just the cells without value "Bye". Can someone >>please help. >> >>Thanks, >>Guy >> >>"Guy" wrote: >> >>> I need a way to auto select all cells within a particular range that do not >>> have a certain value, (Bye), and if possible to also select a custom menu >>> function. The menu function is a 'random sort' feature that I have on my menu >>> bar and I wish to select a certain feature under the dropdown menu (random >>> sort selected cells) with this macro. I would like to have a macro to do both >>> with one click but just the macro to auto select all cells within the range >>> without value (Bye) will do. >>> >>> Thanks, >>> Guy
|