View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
keepITcool keepITcool is offline
external usenet poster
 
Posts: 2,253
Default Get Range, that user marked



of course that fails if the selection is not a range..

if not TypeOf selection Is Range then
MsgBox "ouch"
else
set rng=Selection
end if

on the other hand...

Activewindow.RangeSelection

will work.. but I never see it used..




--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Harald Staff wrote :

Hi Ben

It's Selection :

Sub test()
Dim Rng As Range
Set Rng = Selection
MsgBox Rng.Address & " on " & Rng.Parent.Name & _
Chr(10) & Rng.Count & " cells"
End Sub

HTH. Best wishes Harald

"Ben" skrev i melding
...
How can I get the Range, a user had marked bevor calling the macro?
.Range(??? ActiveCell .... ??? )

Thanks,
Ben