Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Get Range, that user marked
How can I get the Range, a user had marked bevor calling the macro?
..Range(??? ActiveCell .... ??? ) Thanks, Ben |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Get Range, that user marked
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Get Range, that user marked
It works very well. Thanks!
Ben "keepITcool" schrieb: 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 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Get Range, that user marked
Actually,
Activewindow.RangeSelection gives back a range regardless what is selected. It will give the last selected range if currently no range is selected (when e.g. a shape is selected) This can be very handy or very annoying depending on what you want. Dm Unseen |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Get Range, that user marked
in a scenario like "select range, press button" it's indispensable... Sub DoButton() MsgBox ActiveWindow.RangeSelection.Address End Sub -- keepITcool | www.XLsupport.com | keepITcool chello nl | amsterdam DM Unseen wrote : Actually, Activewindow.RangeSelection gives back a range regardless what is selected. It will give the last selected range if currently no range is selected (when e.g. a shape is selected) This can be very handy or very annoying depending on what you want. Dm Unseen |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Marking cell; totaling all # between marked cell & next marked cel | Excel Worksheet Functions | |||
Counting Marked Cells | Excel Worksheet Functions | |||
marked column | Excel Discussion (Misc queries) | |||
How to: User Form to assign a user defined range to a macro variab | Excel Programming | |||
use vb to delete marked rows | Excel Programming |