Forum

Run time error 1004
 
Notifications
Clear all

Run time error 1004

3 Posts
3 Users
0 Reactions
133 Views
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
Topic starter
 

I have this code and get the Error 1004 when running the code. I have double checked that all numbers are correct. It worked previously so I do not know why it will not now. The other macros in the sheet work.  Thanks for your help.

Sub RefreshCounts()
'
' RefreshCounts Macro
'
'
Range("D16:E16").Select
ActiveCell.FormulaR1C1 = "=@CountCcolor(R1C1:R14C25, R[-14]C[32])"
Range("L16:M16").Select
ActiveCell.FormulaR1C1 = "=@CountCcolor(R1C1:R14C25,R[-13]C[24])"
Range("Q16:R16").Select
ActiveCell.FormulaR1C1 = "=@CountCcolor(R1C1:R14C25,R[-12]C[19])"
Range("S18").Select
End Sub

Link to spreadsheet: https://drive.google.com/file/d/1aREautX3RGd6786MBRN7D2sYUUbieg7M/view?usp=sharing

 
Posted : 26/03/2021 3:45 am
(@questvba)
Posts: 125
Estimable Member
 

Hi, Brooke,

This error often occurs when referring to an invalid cell range.

I prefer to work in a different way: I have added a module 6 which calculates the number of cells with the determined colours and then I perform the calculations which I enter in the different cells. In the file, the button 'Refresh Counts' refers to this.

BR,

Lionel

 
Posted : 27/03/2021 1:33 am
(@debaser)
Posts: 836
Member Moderator
 

Your macro works fine for me on 365 but if  you're running a non-365 version, remove the @ symbols from the formula.

 
Posted : 27/03/2021 9:37 am
Share: