|
Re: File wont accept VBA
this is my code
Code:
Private Sub workbook_open()
Sheets(15).Range("BF3").Formula = "=AVERAGE(B3:BB3)"
Sheets(15).Range("BF4").Formula = "=AVERAGE(B4:BB4)"
Sheets(15).Range("BF5").Formula = "=AVERAGE(B5:BB5)"
Sheets(15).Range("BF6").Formula = "=AVERAGE(B6:BB6)"
Sheets(15).Range("BF7").Formula = "=AVERAGE(B7:BB7)"
End Sub
this is the code that was already in the file
Code:
'
' Upload Macro
' Macro designed 1/4/99 by Fawzy Simon
'
'
' Declarations
Dim lgws(18) As String
Sub UpLoad()
' Establish worksheet names array
lgws(2) = "LG Volume Summary 1100"
lgws(3) = "LG Volume Summary 1200"
lgws(4) = "LG Volume Summary 1300"
lgws(5) = "LG Volume Summary 1400"
lgws(6) = "LG Volume Summary 1500"
lgws(7) = "LG Volume Summary 1700"
lgws(8) = "LG Volume Summary 1800"
lgws(9) = "LG Volume Summary 1900"
lgws(10) = "LG Volume Summary 2520"
lgws(11) = "LG Volume Summary 2575"
lgws(12) = "LG Volume Summary 2597"
lgws(13) = "LG Volume Summary 2598"
lgws(14) = "BU Volume Summary Cream Cheese"
lgws(15) = "LG Volume Summary 16000"
lgws(16) = "LG Volume Summary 17000"
lgws(17) = "BU Volume Summary DiGiorno"
lgws(18) = "Plt.Vol. Summary"
inputpassword = InputBox("Enter Password For Update.")
If inputpassword <> "green5" Then
MsgBox ("I asked you not to. Come on now.")
End
End If
inputweek = InputBox("Solve for which week number?") ' Determine current week
' Error handling for current week determination
If Not (IsNumeric(inputweek)) Then
MsgBox ("You have not entered a numeric value...macro exiting.")
End
End If
Application.ScreenUpdating = False ' Turn screen updating off
week = inputweek + 6 ' Variable indicating working column for data insertion
opencounter = 7 'Variable indicating working row for data extraction
For lgcounter = 2 To 18 ' Master Counter
Sheets(lgws(lgcounter)).Select ' Choose each Load Group worksheet to be updated from array
' Upload Plan, QT and Actual data
For counter = 1 To 3
lg = counter + 7 ' Variable indicating working row for data insertion
wsu = counter + 20 ' Variable indicating working row for data extraction
transportvariable = Sheets("Weekend SAIM Upload").Cells(wsu, lgcounter) ' Extract P/Q/A
Cells(lg, week).Value = transportvariable ' Insert P/Q/A
Next counter
' Upload Opening Inventory
opencounter = opencounter + 13
transportvariable = Sheets("Monday SAIM Upload").Cells(opencounter, 3)
Cells(6, week).Value = transportvariable
transportvariable = Sheets("Monday SAIM Upload").Cells(opencounter, 5)
Cells(7, week).Value = transportvariable
' Upload customer and intercompany forecast data
For vcounter = 2 To 9
For hcounter = (-4) To 5
transportvariable = Sheets("Monday SAIM Upload").Cells((opencounter + vcounter), (6 + hcounter))
Cells((9 + vcounter), (week + hcounter)).Value = transportvariable
Next hcounter
Next vcounter
' Upload distress orders data
For vcounter = 10 To 11
For hcounter = (-4) To 5
transportvariable = Sheets("Monday SAIM Upload").Cells((opencounter + vcounter), (6 + hcounter))
Cells((10 + vcounter), (week + hcounter)).Value = transportvariable
Next hcounter
Next vcounter
Next lgcounter
Sheets("Plt.Vol. Summary").Select ' Return to front door
Application.ScreenUpdating = True ' Turn screen updating back on
Calculate ' Calculate values since calculation turned off to speed macro
End Sub
and
Code:
' Module to Print Charts
' by Fawzy Simon
' 3/30/99
' Declarations
Dim ChartPages(40) As String
|