Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ger Ger is offline
external usenet poster
 
Posts: 1
Default Particular cell in Range

I have a square range from 5 rows and 10 cells.
How can i address a cell (in a macro) in this range so that i'm able to get
and put values into a cell (adressed by the row and colum).

I know it must be possible but i cant find the command in the helpfile.

Who can help me?

Thank in advance

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Particular cell in Range

Reference the appropriate cell using:

cells(row,col)

Where Row and Col are integer values corresponding to the
cell you are referencing.

Example Cell b5 is cells(5,2)

-- Jeff
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default Particular cell in Range

A bit more flexible, that allows referencing a point into this grid without
necessarily knowing, or caring, about where it is in absolute terms is to
use

rng(x,y)

where rng is a defined range, x is the relative row, and y is the relative
column. SO, rng(3,4) would be row 4 and column 5 within the area defined by
rng.

--

HTH

Bob Phillips

"Jeff C." wrote in message
...
Reference the appropriate cell using:

cells(row,col)

Where Row and Col are integer values corresponding to the
cell you are referencing.

Example Cell b5 is cells(5,2)

-- Jeff



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Particular cell in Range

I like this:

dim myCell as range
dim iRow as long
dim iCol as long

set myCell = range("c9")
for irow = 0 to 4 '5 - 1
for icol = 0 to 9 '10 - 1
msgbox mycell.offset(irow,icol).value & _
mycell.offset(irow,icol).address
next icol
next irow

..offset is 0 based .offset(0,0) refers to the same cell.

mycell(x,y) is one's based. mycell(1,1) refers to itself.

Alan Beban has some notes at Chip Pearson's site that you may want to
read/print:

http://www.cpearson.com/excel/cells.htm


Ger wrote:

I have a square range from 5 rows and 10 cells.
How can i address a cell (in a macro) in this range so that i'm able to get
and put values into a cell (adressed by the row and colum).

I know it must be possible but i cant find the command in the helpfile.

Who can help me?

Thank in advance


--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Particular cell in Range

Think you are off by one (since this notation is one's based)

? Range("A1:Z26")(3,4).row
3
? Range("A1:Z26")(3,4).Column
4

so rng(3,4) would be cell at the 3rd row and 4th column with the first cell
in rng as the base (1,1) location.

Regards,
Tom Ogilvy


Bob Phillips wrote in message
...
A bit more flexible, that allows referencing a point into this grid

without
necessarily knowing, or caring, about where it is in absolute terms is to
use

rng(x,y)

where rng is a defined range, x is the relative row, and y is the relative
column. SO, rng(3,4) would be row 4 and column 5 within the area defined

by
rng.

--

HTH

Bob Phillips

"Jeff C." wrote in message
...
Reference the appropriate cell using:

cells(row,col)

Where Row and Col are integer values corresponding to the
cell you are referencing.

Example Cell b5 is cells(5,2)

-- Jeff







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default Particular cell in Range

Mea culpa!

I know you're right, I knew so before I wrote it, but I still wrote it with
the Offset value.

Bob


"Tom Ogilvy" wrote in message
...
Think you are off by one (since this notation is one's based)

? Range("A1:Z26")(3,4).row
3
? Range("A1:Z26")(3,4).Column
4

so rng(3,4) would be cell at the 3rd row and 4th column with the first

cell
in rng as the base (1,1) location.

Regards,
Tom Ogilvy


Bob Phillips wrote in message
...
A bit more flexible, that allows referencing a point into this grid

without
necessarily knowing, or caring, about where it is in absolute terms is

to
use

rng(x,y)

where rng is a defined range, x is the relative row, and y is the

relative
column. SO, rng(3,4) would be row 4 and column 5 within the area defined

by
rng.

--

HTH

Bob Phillips

"Jeff C." wrote in message
...
Reference the appropriate cell using:

cells(row,col)

Where Row and Col are integer values corresponding to the
cell you are referencing.

Example Cell b5 is cells(5,2)

-- Jeff









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
Find Last cell in Range when range is date format default105 Excel Discussion (Misc queries) 5 July 7th 09 03:11 PM
RANGE EXCEL copy cell that meets criteria in a range confused Excel Worksheet Functions 3 March 27th 08 01:41 PM
copy range and paste into every 3rd cell of new range thomsonpa New Users to Excel 4 December 3rd 07 01:47 PM
Referencing a named range based upon Range name entry in cell Barb Reinhardt Excel Worksheet Functions 14 June 20th 07 07:19 PM
Selecting range in list of range names depending on a cell informa Courreges Excel Discussion (Misc queries) 2 June 19th 06 10:59 AM


All times are GMT +1. The time now is 09:48 PM.

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"