Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default vba code overwrites formulae?

I have written vba code that reads in data from another workbook into a row.
To perform calculations on that data, I have six other rows referencing that
row. The calculations are by way of formula entered into the referencing
cells.

For example:

Cell A1 reads in "N" from other worksheet. Cell A1.offset(1,0) contains a
formula that returns the value 8 from looking at that cell.

Running the code to read in the data the first time works fine. Everything
updated.

Problem is, that running it a second time, the formulae do not execute - old
values remain in the referencing cells. For example:

On second run
Cell A1 reads in "X" from other worksheet. Cell A1.offset(1,0) containing
the formula retains the value 8, does not see the update.

Have tried saving and closing to refresh. Have tried "activating" the cell
in the code (overwrites the formula!) and "selecting". No go.

If I click in the referencing cell, then click in the formula bar and exit
the cell, formula fires.

How can I ensure formula recalculate on re-reading the data?

Many TIA's


Matilda

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default vba code overwrites formulae?

Check that you don't have manual calculation set, ToolsOptionsCalculate.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Matilda" wrote in message
...
I have written vba code that reads in data from another workbook into a

row.
To perform calculations on that data, I have six other rows referencing

that
row. The calculations are by way of formula entered into the referencing
cells.

For example:

Cell A1 reads in "N" from other worksheet. Cell A1.offset(1,0) contains a
formula that returns the value 8 from looking at that cell.

Running the code to read in the data the first time works fine. Everything
updated.

Problem is, that running it a second time, the formulae do not execute -

old
values remain in the referencing cells. For example:

On second run
Cell A1 reads in "X" from other worksheet. Cell A1.offset(1,0) containing
the formula retains the value 8, does not see the update.

Have tried saving and closing to refresh. Have tried "activating" the cell
in the code (overwrites the formula!) and "selecting". No go.

If I click in the referencing cell, then click in the formula bar and exit
the cell, formula fires.

How can I ensure formula recalculate on re-reading the data?

Many TIA's


Matilda



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default vba code overwrites formulae?

Bingo!

Thanks, Bob

"Bob Phillips" wrote:

Check that you don't have manual calculation set, ToolsOptionsCalculate.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Matilda" wrote in message
...
I have written vba code that reads in data from another workbook into a

row.
To perform calculations on that data, I have six other rows referencing

that
row. The calculations are by way of formula entered into the referencing
cells.

For example:

Cell A1 reads in "N" from other worksheet. Cell A1.offset(1,0) contains a
formula that returns the value 8 from looking at that cell.

Running the code to read in the data the first time works fine. Everything
updated.

Problem is, that running it a second time, the formulae do not execute -

old
values remain in the referencing cells. For example:

On second run
Cell A1 reads in "X" from other worksheet. Cell A1.offset(1,0) containing
the formula retains the value 8, does not see the update.

Have tried saving and closing to refresh. Have tried "activating" the cell
in the code (overwrites the formula!) and "selecting". No go.

If I click in the referencing cell, then click in the formula bar and exit
the cell, formula fires.

How can I ensure formula recalculate on re-reading the data?

Many TIA's


Matilda




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
How to undo overwrites? undo overwrites Excel Discussion (Misc queries) 2 April 19th 10 12:59 PM
Pivot table overwrites neighbouring cells Anissa New Users to Excel 1 February 15th 09 03:55 AM
Pivot table overwrites neighbouring cells Anissa New Users to Excel 0 February 14th 09 03:15 AM
Worksheets.add in VBScript overwrites existing worksheet donparkerjr Excel Worksheet Functions 3 November 9th 06 07:09 PM
Excel Data Validation - copy command overwrites listmic Excel Programming 1 April 9th 04 11:38 PM


All times are GMT +1. The time now is 11:20 AM.

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"