|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
本帖最后由 chaohuahch 于 2018-6-25 21:26 编辑
代码如下: 供参考!- Sub HCH()
- Application.DisplayAlerts = False
- Application.ScreenUpdating = False
- Dim i, num
- Dim str
- Dim arr, brr()
- For num = 2 To 11
- i = Sheet1.Cells(1, num).End(xlDown).Row
- arr = Range(Cells(i - 499, num), Cells(i, num))
- ' arr = Cells(1, num).Offset(499, 1)
- brr = Array("白色", "金丝", "银丝", "咖啡色", "黑金刚", "天蓝色", "浅蓝色", "橘黄色", "雪牙色", "浅咖啡色")
- 'MsgBox ThisWorkbook.Path
- 'MsgBox brr(0)
- str = brr(num - 2)
- Workbooks.Open ThisWorkbook.Path & "" & Range("Q1") & "" & str & ".xlsx"
- Sheets(1).Activate
- Range("A1:A500") = arr
- Workbooks(str & ".xlsx").Close SAVECHANGES:=True
- Erase arr
- Next
- Application.DisplayAlerts = True
- Application.ScreenUpdating = True
- End Sub
复制代码 如果觉得有用。送朵小花吧!
|
评分
-
1
查看全部评分
-
|