Hi, no add-ins, this worked perfectly before the upgrade and immediately today when I opened the file is wont save. This spreadsheet has details of my DAILY Electricity usage so it is updated and saved daily, yesterday it worked last night, but today it does not when I add todays reding, the only difference this morning the 2311 update was installed.
The only way to fix this is that I must delete ALL VBA code, I have tried deleting part by part but does not work.
here is the VBA code
Public X, Y, Z, A, B, C, D, E As Integer
Public ZZ, AvgElec, AvgElec30, AvgElec7 As Double
Public AS1, AE1, BS1, BE1, CS1, CE1, SUMA, XDATE As String
Sub RefGraph()
XDATE = Format(Now(), "DD MMMM YYYY")
'GRAPH ONE
Sheets("Usage").Select
A = Range("B596").Value
B = Range("B597").Value
AS1 = "=Usage!$L$" & A & ":$L$" & B & ""
AE1 = "=Usage!$B$" & A & ":$B$" & B & ""
SUMA = "=Sum(Usage!$L$" & A & ":Usage!$L$" & B & ")"
AvgElec = 0
AvgElec30 = 0
AvgElec7 = 0
Y = A
For X = 1 To 60
ZZ = Worksheets("Usage").Cells(Y, 12).Value2
AvgElec = AvgElec + ZZ
If X >= 30 Then
AvgElec30 = AvgElec30 + ZZ
End If
If X > 53 Then
AvgElec7 = AvgElec7 + ZZ
End If
Y = Y + 1
Next X
AvgElec = Format(AvgElec / 60, "000.0")
AvgElec30 = Format(AvgElec30 / 30, "000.0")
AvgElec7 = Format(AvgElec7 / 7, "000.0")
Sheets("Graph").Select
ActiveSheet.ChartObjects("Chart 5").Activate
ActiveChart.Walls.Select
ActiveSheet.ChartObjects("Chart 5").Activate
ActiveChart.BackWall.Select
ActiveSheet.ChartObjects("Chart 5").Activate
ActiveChart.SeriesCollection(1).Select
Selection.Delete
ActiveChart.ChartType = xl3DColumnClustered
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).Name = "=""Electricy Usage - Past 60 Days"""
ActiveChart.SeriesCollection(1).Values = AS1
ActiveChart.SeriesCollection(1).XValues = AE1
Application.CommandBars("Clip Art").Visible = False
ActiveWindow.ScrollRow = 3
ActiveWindow.ScrollRow = 1
'GRAPH TWO
Sheets("Month by Month").Select
C = Range("D33").Value
D = Range("D34").Value
BS1 = "='Month by Month'!$C$" & C & ":$C$" & D & ""
BE1 = "='Month by Month'!$B$" & C & ":$B$" & D & ""
Sheets("Graph").Select
ActiveSheet.ChartObjects("Chart 6").Activate
ActiveChart.SeriesCollection(1).Select
Selection.Delete
ActiveSheet.ChartObjects("Chart 6").Activate
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).Name = "=""Total Electricy Usage per Month"""
ActiveChart.SeriesCollection(1).Values = BS1
ActiveChart.SeriesCollection(1).XValues = BE1
'GRAPH THREE
Sheets("Usage").Select
CS1 = "='Month by Month'!$D$" & C & ":$D$" & D & ""
CE1 = "='Month by Month'!$B$" & C & ":$B$" & D & ""
Sheets("Graph").Select
ActiveSheet.ChartObjects("Chart 7").Activate
ActiveChart.SeriesCollection(1).Select
Selection.Delete
ActiveSheet.ChartObjects("Chart 7").Activate
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).Name = "=""Average Daily Electrity Usage per Month"""
ActiveChart.SeriesCollection(1).Values = CS1
ActiveChart.SeriesCollection(1).XValues = CE1
ActiveSheet.ChartObjects("Chart 7").Activate
ActiveSheet.ChartObjects("Chart 6").Activate
With ActiveChart
.ChartTitle.Font.Bold = True
.ChartTitle.Font.Size = 12
.ChartTitle.Font.Color = 1
End With
ActiveChart.ChartArea.Select
Selection.Font.Bold = True
Selection.AutoScaleFont = False
With Selection.Font
.Name = "Arial"
.Size = 9
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
.Background = xlAutomatic
End With
ActiveChart.SeriesCollection(1).ApplyDataLabels
ActiveChart.SeriesCollection(1).DataLabels.Select
With Selection.Font
.Name = "Arial"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
End With
ActiveSheet.ChartObjects("Chart 7").Activate
ActiveChart.SeriesCollection(1).ApplyDataLabels
With ActiveChart
.ChartTitle.Font.Bold = True
.ChartTitle.Font.Size = 12
.ChartTitle.Font.Color = 1
End With
ActiveChart.ChartArea.Select
Selection.Font.Bold = True
Selection.AutoScaleFont = False
With Selection.Font
.Name = "Arial"
.Size = 9
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
.Background = xlAutomatic
End With
ActiveChart.SeriesCollection(1).ApplyDataLabels
ActiveChart.SeriesCollection(1).DataLabels.Select
With Selection.Font
.Name = "Arial"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
ActiveChart.SeriesCollection(1).DataLabels
End With
Range("D1").Value = XDATE
Range("I1").Value = AvgElec
Range("L1").Value = AvgElec30
Range("O1").Value = AvgElec7
End Sub
Sub Macro1()
'
' Macro1 Macro
'
'
ActiveWindow.ScrollRow = 2
ActiveWindow.ScrollRow = 8
ActiveSheet.ChartObjects("Chart 6").Activate
ActiveChart.SeriesCollection(1).Select
ActiveSheet.ChartObjects("Chart 6").Activate
ActiveSheet.ChartObjects("Chart 6").Activate
ActiveChart.SeriesCollection(1).ApplyDataLabels
ActiveSheet.ChartObjects("Chart 6").Activate
ActiveChart.SeriesCollection(1).DataLabels.Select
ActiveSheet.ChartObjects("Chart 6").Activate
ActiveChart.SeriesCollection(1).Points(1).DataLabel.Select
ActiveSheet.ChartObjects("Chart 6").Activate
ActiveChart.Axes(xlCategory).Select
ActiveSheet.ChartObjects("Chart 6").Activate
ActiveChart.SeriesCollection(1).DataLabels.Select
ActiveSheet.ChartObjects("Chart 6").Activate
ActiveSheet.ChartObjects("Chart 7").Activate
ActiveChart.SeriesCollection(1).Select
ActiveSheet.ChartObjects("Chart 7").Activate
ActiveChart.SeriesCollection(1).ApplyDataLabels
ActiveSheet.ChartObjects("Chart 7").Activate
ActiveChart.SeriesCollection(1).DataLabels.Select
ActiveSheet.ChartObjects("Chart 7").Activate
ActiveSheet.ChartObjects("Chart 7").Activate
End Sub
Public TUsage, MUsage, Usage As Currency
Public TBuy, MBuy, Buy As Currency
Public FullLoop, LoopDay, DayNo, MonthNo, MonthNoX, YearNo, SRow, SCol, WRow, WCol As Integer
Public MonthName, MonthYear As String
Public DateX As Date
Sub Summary()
Dim X, Y, Z As Integer
TBuy = 0
TUsage = 0
MBuy = 0
MUsage = 0
YearNo = 2010
MonthNo = 3
DayNo = 1
SCol = 6
SRow = 3
WRow = 1
WCol = 1
FullLoop = Worksheets("Usage Hist").Cells(1, 2).Value2
MonthNM = Array("Januaray", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")
For X = 1 To FullLoop
If X = 945 Then
Z = 1945
End If
SRow = SRow + 1
DateX = Worksheets("Usage Hist").Cells(SRow, SCol - 4).Value2
DayNo = Int(Format(DateX, "dd"))
MonthNo = Int(Format(DateX, "mm"))
YearNo = Int(Format(DateX, "yyyy"))
If X = 1 Then MonthNoX = Int(Format(DateX, "mm"))
If MonthNo = MonthNoX Then
If YearNo / 4 = 0 Then
MonthCnt = Array(31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
LoopDay = MonthCnt(MonthNo - 1)
MonthName = MonthNM(MonthNo - 1) & " " & YearNo
Else
MonthCnt = Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
LoopDay = MonthCnt(MonthNo - 1)
MonthName = MonthNM(MonthNo - 1) & " " & YearNo
End If
If MonthNoX < 12 Then
MonthNoX = MonthNoX + 1
Else
MonthNoX = 1
End If
End If
For Y = 1 To LoopDay
'Sheets("Usage Hist").Select
Buy = Worksheets("Usage Hist").Cells(SRow, SCol).Value2
Usage = Worksheets("Usage Hist").Cells(SRow, SCol + 2).Value2
MBuy = MBuy + Buy
MUsage = MUsage + Usage
SRow = SRow + 1
X = X + 1
Next Y
X = X - 1
SRow = SRow - 1
Worksheets("Summary").Cells(WRow, WCol).Value2 = MonthName
Worksheets("Summary").Cells(WRow, WCol + 1).Value2 = MBuy
Worksheets("Summary").Cells(WRow, WCol + 2).Value2 = MUsage
TBuy = MBuy
TUsage = MUsage
MBuy = 0
MUsage = 0
WRow = WRow + 1
Next X
'Worksheets(WorkBookName).Cells(5, 5).Value2 = 3684584
'StrInput = WorksheetFunction.CountA(Range("J" & ColRow & ":AS" & ColRow))
'Sheets("Orders").Range("StartOrders").Offset(TargetRow, 8).Value = CInt(StrInput / 3)
End Sub