D
Dale
I wrote this macro in Excel 2002. And the co-workers that
are using it are running excel 97 and they get the
following error:
Copile Error; Sub or Function not defined.
Here is the code:
Sub LoadFactor()
Dim kWh As Range
Dim Demand As Range
Dim Days As Range
Dim Factor As Range
Set kWh = Worksheets("Customer").Range("G7:G100")
Set Demand = Worksheets("Customer").Range("H7:H100")
Set Days = Worksheets("Customer").Range("K7:K100")
Set Factor = Worksheets("Customer").Range("M7:M100")
Factor.ClearContents
' For Loop for Calculation
For i = 1 To kWh.Cells.Count
If kWh.Cells(i) <> "" And Demand.Cells(i) <> 0 And
Days.Cells(i) <> 0 Then
LF = Round(kWh.Cells(i) / (Demand.Cells(i) *
Days.Cells(i) * 24), 2)
Factor.Cells(i) = LF
End If
If Demand.Cells(i) = 0 And Demand.Cells(i) <> ""
Then
Factor.Cells(i) = "0.00"
End If
If kWh.Cells(i) = "" And Demand.Cells(i) = "" And
Days.Cells(i) = "" Then
Factor.Cells(i) = ""
End If
If Days.Cells(i) = 0 And Days.Cells(i) <> "" Then
Factor.Cells(i) = "0.00"
End If
Next i
' Formatting Columns and Application
Worksheets("Customer").Range("M7:M100").NumberFormat
= "0.00"
Thanks for the help.
are using it are running excel 97 and they get the
following error:
Copile Error; Sub or Function not defined.
Here is the code:
Sub LoadFactor()
Dim kWh As Range
Dim Demand As Range
Dim Days As Range
Dim Factor As Range
Set kWh = Worksheets("Customer").Range("G7:G100")
Set Demand = Worksheets("Customer").Range("H7:H100")
Set Days = Worksheets("Customer").Range("K7:K100")
Set Factor = Worksheets("Customer").Range("M7:M100")
Factor.ClearContents
' For Loop for Calculation
For i = 1 To kWh.Cells.Count
If kWh.Cells(i) <> "" And Demand.Cells(i) <> 0 And
Days.Cells(i) <> 0 Then
LF = Round(kWh.Cells(i) / (Demand.Cells(i) *
Days.Cells(i) * 24), 2)
Factor.Cells(i) = LF
End If
If Demand.Cells(i) = 0 And Demand.Cells(i) <> ""
Then
Factor.Cells(i) = "0.00"
End If
If kWh.Cells(i) = "" And Demand.Cells(i) = "" And
Days.Cells(i) = "" Then
Factor.Cells(i) = ""
End If
If Days.Cells(i) = 0 And Days.Cells(i) <> "" Then
Factor.Cells(i) = "0.00"
End If
Next i
' Formatting Columns and Application
Worksheets("Customer").Range("M7:M100").NumberFormat
= "0.00"
Thanks for the help.