Formula added to cell with macro will not update until cell is entered

SweKenZo

New Member
Joined
Aug 22, 2014
Messages
4
Hi,

I am not sure how to put this. First time posting here, but been Reading ALOT!

What im trying to pull off:


i = 7

Do
If i / 2 > Int(i / 2) Then
Rows(i).Interior.ColorIndex = 15
End If

i = i + 1
Loop Until Sheets("MängderTest").Cells(i, 1).Value = ""

Range("C" & i).NumberFormat = "General"
Range("C" & i).Formula = "=SUMMA(C7:C" & i - 1 & ")"

I want to add a formula to the first free cell in the C column. when i run the macro get #NAME.
I then select the cell and the formula is there '=SUM(C7:C11)'
If I double click the cell and selects another cell the value of the formula will appear.

Do you know any tricks around this? Ive tried changing the format of the cell but with no success.


Many thanks in advance!

//Kenny
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Sheets("Fördelning").Cells(c, 3).Select
SendKeys "{F2}"
SendKeys "{Enter}"

This almost does it. But it only works for one cell. If I put it in a loop - it only works the last cell in the loop.

Any ideas?
 
Upvote 0

Forum statistics

Threads
1,223,907
Messages
6,175,301
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top