I have an xls excel file (excel 97-2003 workbook) in which there is vba code. I want to convert it to 2007 or newer version of excel with this vba code enabled. I have tried:
- save as macro-enabled.xlsm file
- changed the settings of macros from this blog. it changed the document in .xlsm but on values of cell (on which macro is running) it shows #NAME instead of values. orignal file screen shot:
the code of macros:
1.moveAcross.bas
Attribute VB_Name = "MoveAcross"
Sub GoToValues()
Attribute GoToValues.VB_Description = "Macro recorded 23-01-2001 by Murad Assaggaf"
Attribute GoToValues.VB_ProcData.VB_Invoke_Func = " \n14"
'
' GoToValues Macro
' Macro recorded 23-01-2001 by Murad Assaggaf
'
'
ActiveWindow.SmallScroll ToRight:=13
ActiveWindow.LargeScroll Down:=-2
ActiveWindow.SmallScroll Down:=-3
ActiveWindow.SmallScroll ToRight:=2
Range("X6").Select
End Sub
Sub ReturnToProfileArea()
Attribute ReturnToProfileArea.VB_Description = "Macro recorded 23-01-2001 by Murad Assaggaf"
Attribute ReturnToProfileArea.VB_ProcData.VB_Invoke_Func = " \n14"
'
' ReturnToProfileArea Macro
' Macro recorded 23-01-2001 by Murad Assaggaf
'
'
Range("G5").Select
End Sub
2.Demand.bas
Attribute VB_Name = "Demand"
Function Demand(m0, m1, m2, m3, m4, m5, m6, EndInv, ST, Fraction)
Static months(7) As Variant
months(0) = m0
months(1) = m1
months(2) = m2
months(3) = m3
months(4) = m4
months(5) = m5
months(6) = m6
Dim summy
summy = 0
If Fraction > 0 Then
summy = months(ST + 1) * Fraction
End If
For n = 0 To ST
summy = summy + months(n)
Next n
Demand = summy - EndInv
If Demand < 0 Then
Demand = 0
End If
End Function
3.Coverage.bas
Attribute VB_Name = "Coverage"
Function Coverage(m0, m1, m2, m3, m4, m5, m6, EndInv, ST, Fraction)
Static months(7) As Variant
months(0) = m0
months(1) = m1
months(2) = m2
months(3) = m3
months(4) = m4
months(5) = m5
months(6) = m6
Dim summy
summy = 0
If Fraction > 0 Then
summy = months(ST) * Fraction
End If
For n = 0 To (ST - 1)
summy = summy + months(n)
Next n
Coverage = EndInv / (summy / (ST + Fraction))
End Function
#Name
error? Are you putting one of your functions in that cell? Which one? – BruceWayne