Thread: check selection
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones[_2_] Norman Jones[_2_] is offline
external usenet poster
 
Posts: 421
Default check selection

Hi Yngve,

============
Is ther a way to check selection before I sort a sheet, I need to do
it on the fly

============

I am not sure that I have understood your
question, but

Activecell

returns the currently selected cell and

Selection

returns the selected range.

If the selected range is a single cell, Activecell
and will return the same cell.

T|herefore, adapt something like:

'==========
Public Sub Tester()
Dim Rng As Range
Dim rCell As Range

Set Rng = Selection
Set rCell = ActiveCell

MsgBox Prompt:="Selected range = " _
& Selection.Address(External:=True) _
& vbNewLine & "Active cell = " _
& ActiveCell.Address(External:=True)
End Sub
'<<==========

However, a more interesting quesion
might be *why* you need to check the
selection; armed with that information,
it might well be possible to provide a
more useful response.


---
Regards.
Norman