View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Range as Variable

x is already a range.

I don't know what this is supposed to do.
ActiveCell.Range(x)
But you don't usually wrap Range() around a range object variable.

And activell.range() is sometimes useful, but I'm not sure that's what you
really want.

You may want to state your intent in plain old words.



lwm wrote:

When I do this

Set x = Selection

Application.Dialogs(xlDialogActiveCellFont).Show Arg3:=0
'
Selection.AutoFill Destination:=ActiveCell.Range(x), Type:=xlFillDefault

this fails

if I do x = "a1:L1" it works.

I am trying to have the ability to use whatever range the user has already
selected. If I hard code it then I can't allow changes.

"FSt1" wrote:

hi
it worked in 2003. I retested to make sure. here is the copy and paste from
my vb editor..
Sub test1()
Dim x As Range
Set x = Selection
MsgBox x.Address
End Sub
x is the variable. make sure you pre-select the range before running the
macro.

regards
FSt1

"lwm" wrote:

Set x = selection does not seem to work. I want a currently selected area
that I will not know in advance. So it must take the currently selected area
and save that to a variable.

x = what ever the current selction is.

"FSt1" wrote:

or..
you can highlight a range....
dim x as range
set x = selection
msgbox x.address

regards
FSt1

"FSt1" wrote:

hi
current range?????
dim x as range
set x = range("A1:L100")'set to current range

regards
FSt1



"lwm" wrote:

I want to take the current range and assign it to a variable touse in
additional functions.

How do I assign the current range to a variable like X?

Thanks


--

Dave Peterson