Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default indices in named range

Hi All,

I have a For each cycle, like this:

For Each ecell In erng

Next ecell

I can't figure out how to determine row and column indices of ECELL inside
the cycle. I mean that I'd like to know for example, that the current ECELL
is in the 3rd row and 2nd column of ERNG.

Please help! Thanks,
Stefi

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default indices in named range

I found a solution:

ERNG.Row - ECELL.Row + 1
ERNG.Column - ECELL.Column + 1


Is this the best solution?

Stefi


€˛Stefi€¯ ezt Ć*rta:

Hi All,

I have a For each cycle, like this:

For Each ecell In erng

Next ecell

I can't figure out how to determine row and column indices of ECELL inside
the cycle. I mean that I'd like to know for example, that the current ECELL
is in the 3rd row and 2nd column of ERNG.

Please help! Thanks,
Stefi

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default indices in named range

That's the right way to do assuming that erng may not always start in row 1
and/or column 1.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Stefi" wrote in message
...
I found a solution:

ERNG.Row - ECELL.Row + 1
ERNG.Column - ECELL.Column + 1


Is this the best solution?

Stefi


"Stefi" ezt ķrta:

Hi All,

I have a For each cycle, like this:

For Each ecell In erng

Next ecell

I can't figure out how to determine row and column indices of ECELL
inside
the cycle. I mean that I'd like to know for example, that the current
ECELL
is in the 3rd row and 2nd column of ERNG.

Please help! Thanks,
Stefi



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default indices in named range

Thanks Bob for confirming my solution! What about my correction?
Stefi


€˛Bob Phillips€¯ ezt Ć*rta:

That's the right way to do assuming that erng may not always start in row 1
and/or column 1.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Stefi" wrote in message
...
I found a solution:

ERNG.Row - ECELL.Row + 1
ERNG.Column - ECELL.Column + 1


Is this the best solution?

Stefi


"Stefi" ezt Ć*rta:

Hi All,

I have a For each cycle, like this:

For Each ecell In erng

Next ecell

I can't figure out how to determine row and column indices of ECELL
inside
the cycle. I mean that I'd like to know for example, that the current
ECELL
is in the 3rd row and 2nd column of ERNG.

Please help! Thanks,
Stefi




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default indices in named range

I assumed the error and read it as corrected.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Stefi" wrote in message
...
Thanks Bob for confirming my solution! What about my correction?
Stefi


"Bob Phillips" ezt ķrta:

That's the right way to do assuming that erng may not always start in row
1
and/or column 1.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Stefi" wrote in message
...
I found a solution:

ERNG.Row - ECELL.Row + 1
ERNG.Column - ECELL.Column + 1


Is this the best solution?

Stefi


"Stefi" ezt ķrta:

Hi All,

I have a For each cycle, like this:

For Each ecell In erng

Next ecell

I can't figure out how to determine row and column indices of ECELL
inside
the cycle. I mean that I'd like to know for example, that the current
ECELL
is in the 3rd row and 2nd column of ERNG.

Please help! Thanks,
Stefi








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default indices in named range

Stefi,
So you have one way, or

Debug.Print ECell.Address(False, False, xlR1C1, , Range("B4:D5").Cells(1))

NickHK

"Stefi" wrote in message
...
I found a solution:

ERNG.Row - ECELL.Row + 1
ERNG.Column - ECELL.Column + 1


Is this the best solution?

Stefi


"Stefi" ezt ķrta:

Hi All,

I have a For each cycle, like this:

For Each ecell In erng

Next ecell

I can't figure out how to determine row and column indices of ECELL

inside
the cycle. I mean that I'd like to know for example, that the current

ECELL
is in the 3rd row and 2nd column of ERNG.

Please help! Thanks,
Stefi




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default indices in named range

Hi Nick,

I tried this way as well (I supposed that Range("B4:D5") should be
substituted with my range ERNG) but it returned the string "RC", I couldn't
find out why.

Stefi


€˛NickHK€¯ ezt Ć*rta:

Stefi,
So you have one way, or

Debug.Print ECell.Address(False, False, xlR1C1, , Range("B4:D5").Cells(1))

NickHK

"Stefi" wrote in message
...
I found a solution:

ERNG.Row - ECELL.Row + 1
ERNG.Column - ECELL.Column + 1


Is this the best solution?

Stefi


"Stefi" ezt Ć*rta:

Hi All,

I have a For each cycle, like this:

For Each ecell In erng

Next ecell

I can't figure out how to determine row and column indices of ECELL

inside
the cycle. I mean that I'd like to know for example, that the current

ECELL
is in the 3rd row and 2nd column of ERNG.

Please help! Thanks,
Stefi





  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default indices in named range

Sorry, of course

ECELL.Row - ERNG.Row + 1
ECELL.Column - ERNG.Column + 1

Stefi


€˛Stefi€¯ ezt Ć*rta:

I found a solution:

ERNG.Row - ECELL.Row + 1
ERNG.Column - ECELL.Column + 1


Is this the best solution?

Stefi


€˛Stefi€¯ ezt Ć*rta:

Hi All,

I have a For each cycle, like this:

For Each ecell In erng

Next ecell

I can't figure out how to determine row and column indices of ECELL inside
the cycle. I mean that I'd like to know for example, that the current ECELL
is in the 3rd row and 2nd column of ERNG.

Please help! Thanks,
Stefi

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,073
Default indices in named range

Try...

Range(erng(1), ecell).Rows.Count
Range(erng(1), ecell).Columns.Count

Ken Johnson

  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,073
Default indices in named range

Better still Stefi, don't bother with mine, yours works fine.

Ken Johnson



  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default indices in named range

Thanks Ken, nonetheless I tried Your way, too, it works fine, but I'm still
working hard to understand its logic, I like to learn new techniques.

Stefi


€˛Ken Johnson€¯ ezt Ć*rta:

Better still Stefi, don't bother with mine, yours works fine.

Ken Johnson


  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,073
Default indices in named range

On Jul 3, 10:14 pm, Stefi wrote:
Thanks Ken, nonetheless I tried Your way, too, it works fine, but I'm still
working hard to understand its logic, I like to learn new techniques.

Stefi

,,Ken Johnson" ezt ķrta:

Better still Stefi, don't bother with mine, yours works fine.


Ken Johnson


Hi Stefi,

erng(1) is the top-left cell of erng.
Range(erng(1), ecell) is a range with erng(1) the top-left cell and
ecell the bottom-right cell.
So, it's then a matter of counting the rows and columns in
Range(erng(1), ecell) to get ecell's row and column index within that
range.

I think your way is better because it doesn't use the Count function.

Ken Johnson

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
Returning multiple indices for a lookup [email protected] Excel Worksheet Functions 4 June 29th 07 12:04 AM
inserting a named range into new cells based on a named cell Peter S. Excel Discussion (Misc queries) 1 June 4th 06 03:53 AM
Indices - Agreed Standards? Jay New Users to Excel 3 May 24th 06 12:02 PM
Multiple Combo Box Indices? ll Excel Programming 3 April 6th 06 11:26 PM
If any cell in named range = 8 then shade named range JJ[_8_] Excel Programming 3 August 26th 05 11:09 PM


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