物流问答
自己制造一个表格,让各物流公司填,怎么样快速汇总,找到最廉价的一家
按Alt+F11——菜单栏——刺进——模块——张贴以下代码;
按F5——再关闭VBA窗口——回来Excel操作界面:
Sub cfl()
Dim fs, f, f1, fc, s, x, rowss, columnss
Set fs = CreateObject(“Scripting.FileSystemObject”)
Set f = fs.GetFolder(“E:My Documents汇总”) 寄存文件的目录,自己依据实践修正
Set fc = f.Files
x = 1
For Each f1 In fc
If Right(***.Name, 3) = “xls” Then
***.Open (f1.Path)
rowss = Workbooks(***.Name).Sheets(1).Range(“A65536”).End(xlUp).Row
columnss = Workbooks(***.Name).Sheets(1).columns.Count
Workbooks(***.Name).Sheets(1).Range(“A1:z” & CStr(rowss)).Copy
Workbooks(1).Activate
Workbooks(1).Sheets(1).Range(“A” & CStr(x) & “:z” & CStr(x + rowss)).Select
Workbooks(1).Sheets(1).Paste
Application.CutCopyMode = False
For j = 1 To rowss
For i = 1 To columnss
Workbooks(1).Sheets(1).Cells(x + j, i).Value = _
Workbooks(***.Name).Sheets(1).Cells(j, i).Value
Next i
Next j
x = x + rowss
Workbooks(***.Name).Close savechanges:=False
End If
Next
End Sub
http://www.yuntisoft.com/wuliuwenda/114664.html 自己制造一个表格,让各物流公司填,怎么样快速汇总,找到最廉价的一家