Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
dazman
 
Posts: n/a
Default Update of cell values after insert row?


Hi,

I have a worksheet where using VBA I am inserting a new row and setting
cell values
in the new row to values specified in other worksheets. I can control
the values I want to refer
to in this new row with my VBA code, but unfortunately the values in
the rows below my insert
retain the same references, when I thought they would update by one
row.

I.e cell B3 did contain ='Investment M&G'!D3

I insert a new row and set (new) B3 to the same ='Investment M&G'!D3

but I was hoping B*4* would say ='Investment M&G'!D*4* , but it says
='Investment M&G'!D3

Any clever worksheet function syntax I can use to stop this? If it
helps the cells I
want to refer to in the other worksheet are always on the same row as
the worksheet I'm working on


--
dazman
------------------------------------------------------------------------
dazman's Profile: http://www.excelforum.com/member.php...o&userid=25903
View this thread: http://www.excelforum.com/showthread...hreadid=397940

  #2   Report Post  
ronthedog
 
Posts: n/a
Default


dazman Wrote:
Hi,

I have a worksheet where using VBA I am inserting a new row and setting
cell values
in the new row to values specified in other worksheets. I can control
the values I want to refer
to in this new row with my VBA code, but unfortunately the values in
the rows below my insert
retain the same references, when I thought they would update by one
row.

I.e cell B3 did contain ='Investment M&G'!D3

I insert a new row and set (new) B3 to the same ='Investment M&G'!D3

but I was hoping B*4* would say ='Investment M&G'!D*4* , but it says
='Investment M&G'!D3

Any clever worksheet function syntax I can use to stop this? If it
helps the cells I
want to refer to in the other worksheet are always on the same row as
the worksheet I'm working on


Try using an INDIRECT worksheet function in combination with a ROW()
function as follows. If your formula is in A2 and by inserting a row
above with VBA you want it to refer to A3 use the following

=INDIRECT("Sheet1!A" & ROW())

The ROW with empty parentheses will return the same row as the cell
containing the formula which should work in your case


--
ronthedog
------------------------------------------------------------------------
ronthedog's Profile: http://www.excelforum.com/member.php...o&userid=26504
View this thread: http://www.excelforum.com/showthread...hreadid=397940

  #3   Report Post  
dazman
 
Posts: n/a
Default


Very useful tip for the future too


--
dazman
------------------------------------------------------------------------
dazman's Profile: http://www.excelforum.com/member.php...o&userid=25903
View this thread: http://www.excelforum.com/showthread...hreadid=397940

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
Update cell based on date range deversole Excel Discussion (Misc queries) 3 July 6th 05 01:58 PM
Possible Lookup Table Karen Excel Worksheet Functions 5 June 8th 05 09:43 PM
Toggle multiple values in single cell Chandni Excel Worksheet Functions 5 February 10th 05 12:48 AM
Challenging Charting C TO Charts and Charting in Excel 0 January 17th 05 06:57 PM
GET.CELL Biff Excel Worksheet Functions 2 November 24th 04 07:16 PM


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