|
楼主 |
发表于 2012-4-28 10:07
|
显示全部楼层
jlhao 发表于 2012-4-28 09:57
可以用下面两行来取当前文件名和路径,你的代码不全,应该在存文件前把文件名变量赋值
Sub 分列()
'
' 分列 宏
'
' 快捷键: Ctrl+d
'
ActiveWindow.SmallScroll Down:=-9
Range("A23").Select
ActiveWindow.ScrollRow = 342
ActiveWindow.ScrollRow = 527
ActiveWindow.ScrollRow = 852
ActiveWindow.ScrollRow = 1085
ActiveWindow.ScrollRow = 1967
ActiveWindow.ScrollRow = 2741
ActiveWindow.ScrollRow = 3205
ActiveWindow.ScrollRow = 3964
ActiveWindow.ScrollRow = 4413
ActiveWindow.ScrollRow = 4970
ActiveWindow.ScrollRow = 5264
ActiveWindow.ScrollRow = 5837
ActiveWindow.ScrollRow = 6100
ActiveWindow.ScrollRow = 6333
ActiveWindow.ScrollRow = 6611
ActiveWindow.ScrollRow = 7076
ActiveWindow.ScrollRow = 7230
ActiveWindow.ScrollRow = 7463
ActiveWindow.ScrollRow = 7587
ActiveWindow.ScrollRow = 7803
ActiveWindow.ScrollRow = 7927
ActiveWindow.ScrollRow = 8144
ActiveWindow.ScrollRow = 8314
ActiveWindow.ScrollRow = 8531
ActiveWindow.ScrollRow = 8686
ActiveWindow.ScrollRow = 8887
ActiveWindow.ScrollRow = 9026
ActiveWindow.ScrollRow = 9196
ActiveWindow.ScrollRow = 9413
ActiveWindow.ScrollRow = 9522
ActiveWindow.ScrollRow = 9599
ActiveWindow.ScrollRow = 9676
ActiveWindow.ScrollRow = 9738
ActiveWindow.ScrollRow = 9800
ActiveWindow.ScrollRow = 9816
ActiveWindow.ScrollRow = 9862
ActiveWindow.ScrollRow = 9878
ActiveWindow.ScrollRow = 9893
ActiveWindow.ScrollRow = 9924
ActiveWindow.ScrollRow = 9940
ActiveWindow.ScrollRow = 9971
ActiveWindow.ScrollRow = 9986
ActiveWindow.SmallScroll Down:=6
Range("A23:A10023").Select
Selection.TextToColumns Destination:=Range("A23"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=True, Other:=False, FieldInfo _
:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1)), _
TrailingMinusNumbers:=True
ChDir "D:\paper\data\distance\lz\flat50q0.02pro++--0.02pme\2\xlx"
ActiveWorkbook.SaveAs Filename:= _
"D:\paper\data\distance\lz\flat50q0.02pro++--0.02pme\2\xlx\" & ThisWorkbook.Name &".xvg" _
, FileFormat:=xlExcel8, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
End Sub |
|