Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default How to reference variable range in a loop

Dear all,
In my loop the number of rows for range changes. I have to copy paste from
one Sheet to other. I tried following ways:

....
d =
number_rows = ...
name_range = "a2:i" & number_rows + 1
Sheets(1).range(name_range).Value = Sheets(2).range(name_range).offset
(d,0).Value
.....

This does not work...

the second way I tried

....
d = ...
number_rows = ...
Sheets(1).range(Cells(2,1), Cells(number_rows+1,9)).Value =
Sheets(2).range(Cells(2,1), Cells(number_rows+1+d,9)).Value
.....

This does not work too...
Please help
How to prepare a reference using Concatenate or any other function?
How can one use Cells in Range(...) in multiple Sheets?
Thanks for your time
Samir

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
How to reference variable range? WhatsUp31415 Excel Discussion (Misc queries) 4 May 17th 09 07:20 PM
For Each ... Next loop - need to reference the loop variable [email protected] Excel Programming 4 July 13th 06 06:12 PM
Setting a range within a loop variable for copy/paste Craig[_24_] Excel Programming 3 December 21st 05 04:05 PM
Variable Range Reference Bob Excel Programming 3 December 16th 04 04:13 PM
Excel VBA Loop & Variable Reference Carolyn[_4_] Excel Programming 2 October 15th 04 08:30 PM


All times are GMT +1. The time now is 04:40 AM.

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

About Us

"It's about Microsoft Excel"