Group:  Microsoft Excel ยป microsoft.public.excel.worksheet.functions
Thread: Macro to select cells without a certain value and select a menu it

Geek News

Macro to select cells without a certain value and select a menu it
Guy 12/30/2008 10:01:05 PM
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
RE: Macro to select cells without a certain value and select a menu it
Guy 12/31/2008 5:42:19 PM
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:

[Quoted Text]
> 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
Re: Macro to select cells without a certain value and select a menu it
Gord Dibben <gorddibbATshawDOTca> 12/31/2008 8:07:10 PM
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:

[Quoted Text]
>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

Re: Macro to select cells without a certain value and select a menu it
Gord Dibben <gorddibbATshawDOTca> 12/31/2008 8:18:54 PM
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

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net