Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default How to use the rownumber of the current cell in a formula

Hi,

is there a way to retrieve the rownumber of the cell that "has the focus"? I
would like to calculate a number of values in the top row, but the formulas
need the rownumber to look up the correct prices.

In the formula below, the cell will contain a value of 50, 20 or zero,
depending on where the user's cursor is placed, the rownumber is then put in
D5

=IF(INDIRECT(CONCATENATE("H";D5))0;50;IF(INDIRECT (CONCATENATE("L";D5))0;20;0))

Thanks,

Wim Goelen
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 396
Default How to use the rownumber of the current cell in a formula

You could use the function ROW() (so without argument between brackets).

--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


"Wim Goelen" wrote:

Hi,

is there a way to retrieve the rownumber of the cell that "has the focus"? I
would like to calculate a number of values in the top row, but the formulas
need the rownumber to look up the correct prices.

In the formula below, the cell will contain a value of 50, 20 or zero,
depending on where the user's cursor is placed, the rownumber is then put in
D5

=IF(INDIRECT(CONCATENATE("H";D5))0;50;IF(INDIRECT (CONCATENATE("L";D5))0;20;0))

Thanks,

Wim Goelen

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,805
Default How to use the rownumber of the current cell in a formula

Only through VBA - ActiveCell.Row

"Wim Goelen" wrote:

Hi,

is there a way to retrieve the rownumber of the cell that "has the focus"? I
would like to calculate a number of values in the top row, but the formulas
need the rownumber to look up the correct prices.

In the formula below, the cell will contain a value of 50, 20 or zero,
depending on where the user's cursor is placed, the rownumber is then put in
D5

=IF(INDIRECT(CONCATENATE("H";D5))0;50;IF(INDIRECT (CONCATENATE("L";D5))0;20;0))

Thanks,

Wim Goelen

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 791
Default How to use the rownumber of the current cell in a formula

After you hit Alt F11, when you see the vba Project window on the left hand
side of your screen click on the Sheet Name that you want to add the code on
For example Sheet1 and the right hand side select from the first dropdown box
Worksheet and from the second dropdown box choose selection change and paste
the code below:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
MyRow = Target.Row
Range("A20").Value = MyRow
End Sub
Then on your formula point to A20 to provide the active row number.


--
If this posting was helpful, please click on the Yes button.
Regards,

Michael Arch.




"Wim Goelen" wrote:

Hi,

is there a way to retrieve the rownumber of the cell that "has the focus"? I
would like to calculate a number of values in the top row, but the formulas
need the rownumber to look up the correct prices.

In the formula below, the cell will contain a value of 50, 20 or zero,
depending on where the user's cursor is placed, the rownumber is then put in
D5

=IF(INDIRECT(CONCATENATE("H";D5))0;50;IF(INDIRECT (CONCATENATE("L";D5))0;20;0))

Thanks,

Wim Goelen

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
CURRENT TIME IN DESTINATION CELL IF SOURCE CELL IS TEXT Thomasel Excel Discussion (Misc queries) 3 April 15th 08 11:19 PM
formula to change current cell value Robert H Excel Worksheet Functions 2 February 20th 07 07:39 AM
formula won't paste from one cell to another with current cell inf kentndebra Excel Worksheet Functions 1 August 22nd 06 04:52 PM
formula, move to previous cell when the current cell=0 or empty osama amer Excel Discussion (Misc queries) 0 May 29th 06 12:18 PM
Can I get current #row or #column in cell formula? ryany Excel Discussion (Misc queries) 2 February 13th 06 11:27 AM


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