|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
问题已经解决,非常感谢大家的帮助![code]
附注:
以前是可以运行的,突然不能用了,请问是怎么回事呢?
我也没有禁用宏啊
而且单独运行该宏是可以的。
因为我有好几个单独运行的宏,我想另外单独做一个总宏,调用已经编好的所有的宏。
先行谢过~
不断学习,不断进步…………
问题已经解决,非常感谢大家的帮助![code]
PS:是宏名称引用不对,转到excel界面,打开宏,
这样就能看到宏的名称了。如下图示:
Workbooks("facility.csv").Sheets("facility").Copy after:=Workbooks("convertdata.xlsm").Sheets("exposure")
Sub Exposure()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Workbooks.Open ("C:\Documents and Settings\pyuan\Desktop\Test\Test data\facility.csv")
Workbooks("facility.csv").Sheets("facility").Copy after:=Workbooks("convertdata.xlsm").Sheets("exposure")
On Error Resume Next
ActiveSheet.NAME = "facilitydata"
Workbooks("facility.csv").Close
Dim m As Integer, n As Integer
Sheets("facility").Select
m = ActiveSheet.UsedRange.Rows.Count
n = ActiveSheet.UsedRange.Columns.Count
Range(Cells(2, 1), Cells(m, n)).Select
Selection.Copy
Sheets("exposure").Select
Cells(2, 1).Select
ActiveSheet.Paste
Range("B:B").Select
Selection.NumberFormatLocal = "@"
On Error Resume Next
Sinpdel "facilitydata"
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Sheets("conversionpage").Select
End Sub
Sub delandcopy()
On Error Resume Next
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Workbooks("convertdata.xlsm").Activate
'sinpaddlast "BlankSheet"
Dim sh As Worksheet
For Each sh In Worksheets
If LCase(sh.NAME) <> "conversionpage" Then
sh.Delete
End If
Next
'ActiveSheet.NAME = "sheet1"
'copy all the sheets
Workbooks.Open ("C:\Documents and Settings\pyuan\Desktop\Test\Test data\ZTestPortfoliotInput.xlsx")
For Each sh In Worksheets
sh.Copy before:=Workbooks("convertdata.xlsm").Sheets(1)
Next
ActiveWorkbook.Save
Workbooks("ZTestPortfoliotInput.xlsx").Close
'clear all the contents
Workbooks("convertdata.xlsm").Activate
ActiveWorkbook.Save
Dim p, q As Integer
For Each sh In Worksheets
If LCase(sh.NAME) <> "conversionpage" Then
sh.Select
p = ActiveSheet.UsedRange.Rows.Count
q = ActiveSheet.UsedRange.Columns.Count
'p = sh.[a1048576].End(3).Row
'q = sh.[xdf1].End(xlToLeft).Column
Range(Cells(2, 1), Cells(p + 1, q + 1)).ClearContents
End If
Next
Application.DisplayAlerts = True
Err.Clear
On Error GoTo 0
Sheets("conversionpage").Select
End Sub
Sub convertall()
If MsgBox("Do you want to convert the data?", vbYesNo, "DesignedByXP") = vbYes Then
tt = Timer
Application.ScreenUpdating = False
delandcopy
currencyLookup.currencyLookup
currencydiscouncurvemap
customcashflow.customcashflow
DefaultStatistic.DefaultStatistic
Exposure.Exposure
Group.Group
PortfolioToExposure.PortfolioToExposure
RunParameter.RunParameter
runparameterseed.runparameterseed
UsageFee.UsageFee
YieldCurve.YieldCurve
YieldCurveItem.YieldCurveItem
Tranche
TransitionMatrix
TransitionMatrixBucket
transitionmatrixvalue
exposuretypelookup.exposuretypelookup
portfolio
copyallsheets
On Error Resume Next
Workbooks("ZPortfoliotestOutput.xlsx").Save
Workbooks("ZPortfoliotestOutput.xlsx").Close
Workbooks("convertdata.xlsm").Sheets("conversionpage").Select
Application.ScreenUpdating = True
t = Timer - tt
MsgBox "Time Cost is: " & t & " " & "seconds"
Else
Exit Sub
End If
End Sub
[ 本帖最后由 seanpple 于 2010-4-28 22:32 编辑 ] |
|