PC Review


Reply
Thread Tools Rate Thread

capturing current range of cells

 
 
lwm
Guest
Posts: n/a
 
      28th Jan 2008

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.

 
Reply With Quote
 
 
 
 
Bob Flanagan
Guest
Posts: n/a
 
      28th Jan 2008
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

"lwm" <(E-Mail Removed)> wrote in message
news:52F4E732-72C1-4871-AB5B-(E-Mail Removed)...
>
> 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.
>



 
Reply With Quote
 
lwm
Guest
Posts: n/a
 
      28th Jan 2008
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.

"Bob Flanagan" wrote:

> 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
>
> "lwm" <(E-Mail Removed)> wrote in message
> news:52F4E732-72C1-4871-AB5B-(E-Mail Removed)...
> >
> > 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.
> >

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
change colors in a range of excel cells based on another range of cells Bobbi Muck Microsoft Excel Programming 1 9th Apr 2010 03:47 AM
referencing current range of cells selected Tom Microsoft Excel Programming 1 12th Dec 2008 01:42 PM
Capturing current Worksheet Name as a variable Jimbob Microsoft Excel Programming 3 4th Apr 2008 08:25 PM
Capturing current folder path =?Utf-8?B?REtT?= Microsoft Excel Programming 2 14th Aug 2006 11:34 AM
Copy a range of cells in an unopened workbook and paste it to the current workbook topstar Microsoft Excel Programming 3 24th Jun 2004 12:50 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:06 PM.