I have a pretty single code and my if then function is causing an out of memory error
Sub Macro16()
'
' Macro16 Macro
'
Dim ProjName As String
For x = 1 To 51
Sheets("sheet10").Activate
If cells.Value = "" Then
Sheets("sheet10").Activate
cells(x, 1).Select
ProjName = ActiveCell.Value
Sheets("DATA").Activate
ActiveSheet.PivotTables("PivotTable5").AddDataField ActiveSheet.PivotTables( _
"PivotTable5").PivotFields(ProjName), "Count of " & ProjName _
, xlCount
With ActiveSheet.PivotTables("PivotTable5").PivotFields( _
"Count of " & ProjName)
.Caption = "Average of " & ProjName
.Function = xlAverage
.NumberFormat = "$#,##0.00"
End With
End If
Next
End Sub
Sub Macro16()
'
' Macro16 Macro
'
Dim ProjName As String
For x = 1 To 51
Sheets("sheet10").Activate
If cells.Value = "" Then
Sheets("sheet10").Activate
cells(x, 1).Select
ProjName = ActiveCell.Value
Sheets("DATA").Activate
ActiveSheet.PivotTables("PivotTable5").AddDataField ActiveSheet.PivotTables( _
"PivotTable5").PivotFields(ProjName), "Count of " & ProjName _
, xlCount
With ActiveSheet.PivotTables("PivotTable5").PivotFields( _
"Count of " & ProjName)
.Caption = "Average of " & ProjName
.Function = xlAverage
.NumberFormat = "$#,##0.00"
End With
End If
Next
End Sub