capturing current range of cells

L

lwm

I am developing several utilities that I can give to my customers. I am a
financial and accounting consultant to businesses specializing in Excel.

The user selects a cell.

I want to place that cell in a variable so I can use it in the future.

i.e. x= cell selected.

Location of new stuff cells(1,x+6)

Or
range = range(x, x=6)
range(x).select
Or

The user selects a range a12.r12

I want to save that range in a variable so I can use it in a future function.

‘X= “A12.R12†won’t work because it is absolute. I need a relative address..

I am looking for something like

X= range.select

Selection.AutoFill Destination:=ActiveCell.Range(x), Type:=xlFillDefault

This selects the appropriate range and then copies the appropriate data.
 
B

Bob Flanagan

dim X as range
Set x = selection

or

Dim X as range
Set X = Range(activecell, activecell.offset(6,1))

Bob Flanagan
Macro Systems
144 Dewberry Drive
Hockessin, Delaware, U.S. 19707

Phone: 302-234-9857, cell 302-584-1771
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel
 
L

lwm

Unfortunately this

Selection.AutoFill Destination:=ActiveCell.Range(x), Type:=xlFillDefault

gives the error select only one cell.

If I use x="a1:L1" it works


dim X as range
Set x = selection

gives erro that is my problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top