Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Selecting range of cells to copy using a variable

I need to copy a range of cells but the size of the range may change.
I will be using a variable to determine the size of the table. How can
I select a range with this variable to copy and paste the range of
cells.

Frank
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Selecting range of cells to copy using a variable

examples


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

wrote in message
...
I need to copy a range of cells but the size of the range may change.
I will be using a variable to determine the size of the table. How can
I select a range with this variable to copy and paste the range of
cells.

Frank


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Selecting range of cells to copy using a variable

On Jan 24, 8:08*pm, "Don Guillett" wrote:
examples

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
wrote in message

...



I need to copy a range of cells but the size of the range may change.
I will be using a variable to determine the size of the table. How can
I select a range with this variable to copy and paste the range of
cells.


Frank- Hide quoted text -


- Show quoted text -


I'm still lost. I'm trying to get something like RANGE(A1:B4).Select,
but I don't have a predefined range and need to use variables.

Eg. RANGE(Start:End).Select

Can anyone help.

Frank
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Selecting range of cells to copy using a variable

On Jan 25, 8:08*am, "Don Guillett" wrote:
lr=cells(rows.count,"a").end(xlup).row
RANGE("A1:B"&lr).copy'NO need to select

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
wrote in message

...
On Jan 24, 8:08 pm, "Don Guillett" wrote:





examples


--
Don Guillett
Microsoft MVP Excel
SalesAid Software
wrote in message


...


I need to copy a range of cells but the size of the range may change.
I will be using a variable to determine the size of the table. How can
I select a range with this variable to copy and paste the range of
cells.


Frank- Hide quoted text -


- Show quoted text -


I'm still lost. *I'm trying to get something like RANGE(A1:B4).Select,
but I don't have a predefined range and need to use variables.

Eg. RANGE(Start:End).Select

Can anyone help.

Frank- Hide quoted text -

- Show quoted text -


I don't know the start cell, because it can change as well. I need to
control both the start and end cell using a variable. Can you show
how this is possible?

Frank


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 389
Default Selecting range of cells to copy using a variable

If Start is A1 and End is C2, here are different ways to do it.

Range(Range("A1"), Range("C2")).Select

Range(Cells(1, "A"), Cells(2, "C")).Select

Range(Cells(1, 1), Cells(2, 3)).Select

Range("A1").Resize(2, 3).Select

Range(Range("Start"),Range("End")).Select

--
Tim Zych
SF, CA

------------------
I'm still lost. I'm trying to get something like RANGE(A1:B4).Select,
but I don't have a predefined range and need to use variables.


Eg. RANGE(Start:End).Select


Can anyone help.


Frank



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Selecting range of cells to copy using a variable

On Jan 25, 6:31*pm, "Don Guillett" wrote:
If desired, send me a workbook with your examples and snippets of these
emails.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
wrote in message

...
On Jan 25, 8:08 am, "Don Guillett" wrote:





lr=cells(rows.count,"a").end(xlup).row
RANGE("A1:B"&lr).copy'NO need to select


--
Don Guillett
Microsoft MVP Excel
SalesAid Software
wrote in message


...
On Jan 24, 8:08 pm, "Don Guillett" wrote:


examples


--
Don Guillett
Microsoft MVP Excel
SalesAid Software
wrote in message


....


I need to copy a range of cells but the size of the range may change.
I will be using a variable to determine the size of the table. How can
I select a range with this variable to copy and paste the range of
cells.


Frank- Hide quoted text -


- Show quoted text -


I'm still lost. I'm trying to get something like RANGE(A1:B4).Select,
but I don't have a predefined range and need to use variables.


Eg. RANGE(Start:End).Select


Can anyone help.


Frank- Hide quoted text -


- Show quoted text -


I don't know the start cell, because it can change as well. I need to
control both the start and end cell using a variable. *Can you show
how this is possible?

Frank- Hide quoted text -

- Show quoted text -


TableSize = TableSize + 1
Do While Cells(TableSize, 1) < ""
TableSize = TableSize + 1
Loop

Range("A1:K" &TableSize).Select
Selection.Copy
Cells(TableSize*2+5,1).select
ActiveSheet.Paste

Range("C &TableSize*2+5:C" &TableSize*2+6).Select
Application.CutCopyMode = False
Selection.Merge

Above is an example. I start with a loop to determine the size of the
table. Then I make a copy of this table. Next, I need to select two
cells to merge them together. I don't know the absolute value of
these cells. How can I accomplish this?

Frank

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Selecting range of cells to copy using a variable

On Jan 25, 6:48*pm, "Tim Zych" <tzych@NOSp@mE@RTHLINKDOTNET wrote:
If Start is A1 and End is C2, here are different ways to do it.

Range(Range("A1"), Range("C2")).Select

Range(Cells(1, "A"), Cells(2, "C")).Select

Range(Cells(1, 1), Cells(2, 3)).Select

Range("A1").Resize(2, 3).Select

Range(Range("Start"),Range("End")).Select

--
Tim Zych
SF, CA

------------------



I'm still lost. *I'm trying to get something like RANGE(A1:B4).Select,
but I don't have a predefined range and need to use variables.
Eg. RANGE(Start:End).Select
Can anyone help.
Frank- Hide quoted text -


- Show quoted text -


Thanks Tim. That helps.

Frank
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Selecting range of cells to copy using a variable

I still can't determine what you want. As I said, send a wb with a clear
explanation and before/after examples.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

wrote in message
...
On Jan 25, 6:31 pm, "Don Guillett" wrote:
If desired, send me a workbook with your examples and snippets of these
emails.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
wrote in message

...
On Jan 25, 8:08 am, "Don Guillett" wrote:





lr=cells(rows.count,"a").end(xlup).row
RANGE("A1:B"&lr).copy'NO need to select


--
Don Guillett
Microsoft MVP Excel
SalesAid Software
wrote in message


...
On Jan 24, 8:08 pm, "Don Guillett" wrote:


examples


--
Don Guillett
Microsoft MVP Excel
SalesAid Software
wrote in message


...


I need to copy a range of cells but the size of the range may change.
I will be using a variable to determine the size of the table. How
can
I select a range with this variable to copy and paste the range of
cells.


Frank- Hide quoted text -


- Show quoted text -


I'm still lost. I'm trying to get something like RANGE(A1:B4).Select,
but I don't have a predefined range and need to use variables.


Eg. RANGE(Start:End).Select


Can anyone help.


Frank- Hide quoted text -


- Show quoted text -


I don't know the start cell, because it can change as well. I need to
control both the start and end cell using a variable. Can you show
how this is possible?

Frank- Hide quoted text -

- Show quoted text -


TableSize = TableSize + 1
Do While Cells(TableSize, 1) < ""
TableSize = TableSize + 1
Loop

Range("A1:K" &TableSize).Select
Selection.Copy
Cells(TableSize*2+5,1).select
ActiveSheet.Paste

Range("C &TableSize*2+5:C" &TableSize*2+6).Select
Application.CutCopyMode = False
Selection.Merge

Above is an example. I start with a loop to determine the size of the
table. Then I make a copy of this table. Next, I need to select two
cells to merge them together. I don't know the absolute value of
these cells. How can I accomplish this?

Frank

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Selecting a Range with a Variable in VB ClinicITguy1 Excel Programming 3 February 20th 07 06:33 PM
Selecting a variable range Bill Excel Programming 4 August 16th 06 05:42 PM
Copy only Visible Cells of a Variable Range... Damian Carrillo[_2_] Excel Programming 2 July 21st 05 01:12 AM
selecting range of cells - variable # of rows [email protected] Excel Programming 6 April 15th 05 02:10 PM
Selecting a variable range Colin Foster[_3_] Excel Programming 3 October 26th 04 11:02 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"