When using the below within powerpoint, I constantly get
Run-time error 1004 - Unable to get the Sum property of the WorksheetFunction class
Can anyone help?
TextBox10.Value = WorksheetFunction.Sum(Staff_Engagement_1.Value, Annual_Cost_To_Business_1.Value, Cost_To_Absence_1.Value, (-1) * TextBox11.Value)
You can't use worksheetfunction in PowerPoint. Since i'm assuming you're using a form by the TextBox10.Value, see How can I sum value in 8 textboxes to the a single textbox?
Related
I've figured out how to insert a formula into a range of cells and managed to make it work once. Unfortunately, I can't get it to work with this formula. Instead I get an
Application-defined or object-defined error.
Here's what I'm attempting to run.
Sheets("P&L").Select
Range("A1:A250").Select
Selection.FormulaR1C1 = "=IF(ISNUMBER(LEFT(RC[+1],4)*1),LEFT(RC[+1]4,4)*1,)"
Selection.Columns.AutoFit
I suspect it has something to do with the * acting as a wildcard. I've put it in block quotes, but that just gives another error.
Any help is appreciated.
You've got an extra 4 in that formula.
Selection.FormulaR1C1 = "=IF(ISNUMBER(LEFT(RC[+1],4)*1),LEFT(RC[+1],4)*1, text(,))"
I'm trying to use the following code to input a formula but for some reason I get an application defined / object defined error for the 'iferror' formula I'm using.
ws_catalogue.Range("D3").Formula = "=IFERROR(INDEX('Test Input'!$E:$E,MATCH(CONCATENATE([#Actor],[#Entity],D$1),'Test Input'!$A:$A,0)),"""")"
ws_catalogue.Range("D3:N3").FillRight
ws_catalogue.Range("D3:N" & Total_cat).FillDown
Thanks in advance!
I'm using this formula
ThisWorkbook.Sheets("Overview").Range(formrange).Formula = "=IF(OR(ISBLANK(B2);WEEKDAY(DATE($B$38;$B$37;B2);2)>5;DAY(EOMONTH(DATE($B$38;$B$37;B$3);0))<B2);0;IF(C2=""Y"";0,5;1))"
And am having the following error
Run-time error "1004"
Application-denied or object-defined error
Would you guys have an idea what that is?
The Range.Formula property needs a formula string in the same format it would be entered into a cell on a computer with US regional settings. So for this example you need:
ThisWorkbook.Sheets("Overview").Range(formrange).Formula = "=IF(OR(ISBLANK(B2),WEEKDAY(DATE($B$38,$B$37,B2),2)>5,DAY(EOMONTH(DATE($B$38,$B$37,B$3),0))<B2),0,IF(C2=""Y"",0.5,1))"
I am trying to implement a "COUNTIF()" function in my vba excel application. I know how to do this programatically but I want specifically to implement this as a formula so that later changes in the sheet will hold. This is the problematic line:
ActiveSheet.Cells(3, 20).FormulaR1C1 = "=COUNTIF(R11C7:R12C7;"">0"")"
It results in the following error:
Run-time error '1004': Application-defined or object-defined error
VBA defaults to US formatting unless otherwise specified - which you could do here using FormulaR1C1Local - so you need to use a comma separator, not a semicolon.
I am trying to collapse the pivot items through loop using VBA. Below is the code:
Dim oPI As PivotItems
For Each oPI In ActiveSheet.PivotTables("PivotTable4").PivotFields("TAG").PivotItems
oPI.ShowDetail = False
Next oPI
I am getting Runtime error 13 - "Type mismatch" error. Not sure what is wrong with this code.
Could anyone please let me know what changes to make?
Replace your declaration for oPi:
Dim oPi as Object
will achieve what you want. A For Each loop requires a variable of type Object/Variant.
Use this mate:
ActiveSheet.PivotTables("Name_of_your_pitot_table").PivotFields("pivot_field_name").ShowDetail = False