Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Refer to Ranges using Cells notation

Hi,

I am trying to pass through a worksheet using VBA with a nested For loop and
would like to refer to the cells that I pass through using the Cells(row,
col) notation. Is there a way to refer to a range of cells (e.g. A1:A100)
using the Cells(row, col) notation instead of having to use the Range
notation?

Thanks in advance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 783
Default Refer to Ranges using Cells notation

There are several ways. One is

Set rng = Range("A1")
MsgBox Range(rng(1),rng(100)).Address

It will display $A$1:$A$100

Alan Beban

Scott P wrote:
Hi,

I am trying to pass through a worksheet using VBA with a nested For loop and
would like to refer to the cells that I pass through using the Cells(row,
col) notation. Is there a way to refer to a range of cells (e.g. A1:A100)
using the Cells(row, col) notation instead of having to use the Range
notation?

Thanks in advance.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Refer to Ranges using Cells notation

I believe that I have found the answer to my own question, so I am posting it
here. It appears Excel allows you to refer to ranges of cells using the
"cells" notation using syntax such as this:

Set rng = Range(Cells(1, 1), Cells(1, 100))



"Scott P" wrote:

Hi,

I am trying to pass through a worksheet using VBA with a nested For loop and
would like to refer to the cells that I pass through using the Cells(row,
col) notation. Is there a way to refer to a range of cells (e.g. A1:A100)
using the Cells(row, col) notation instead of having to use the Range
notation?

Thanks in advance.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Refer to Ranges using Cells notation

with activesheet
set rng = range(.cells(1,1),.cells(100,1))
'or
set rng = .cells(1,1).resize(100,1)
end with

Tim

"Scott P" wrote in message
...
Hi,

I am trying to pass through a worksheet using VBA with a nested For
loop and
would like to refer to the cells that I pass through using the
Cells(row,
col) notation. Is there a way to refer to a range of cells (e.g.
A1:A100)
using the Cells(row, col) notation instead of having to use the
Range
notation?

Thanks in advance.



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
entering formula using cells notation jk22 Excel Worksheet Functions 6 February 25th 09 08:57 AM
how to find cells that refer to data in other cells in excel Aman Excel Discussion (Misc queries) 8 December 2nd 07 10:02 PM
Scientific notation in text cells miles Excel Discussion (Misc queries) 3 December 7th 06 10:59 PM
Refer to Worksheet Ranges in Code Andibevan[_2_] Excel Programming 8 March 30th 05 12:20 PM
refer to a cells value in a macro loulou Excel Programming 4 February 24th 05 01:35 PM


All times are GMT +1. The time now is 05:46 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"