- excel vba教程:2013新体验――快速提取混合内容中的地址
- 表格制作快速入门:SUMIF函数14种经典用法,速收!
- excel宏教程:美丽的Excel数据区域
- excel表格制作:短平快!不用公式也能多条件查询
解决问题的过程可以写为:
Sub 生成档案卡文件()
Application.ScreenUpdating = False
Dim Irow As Long, Sht As Worksheet
Set Sht = ThisWorkbook.Worksheets("档案信息")
For Irow = 2 To Sht.UsedRange.Rows.Count
With ThisWorkbook.Worksheets("档案卡")
.Range("C4:E4").Value = Sht.Range("A" & Irow & ":C" & Irow).Value
.Range("C7:E7").Value = Sht.Range("D" & Irow & ":F" & Irow).Value
.Range("C10").Value = "'" & Sht.Cells(Irow, "G").Value
.Range("E10").Value = Sht.Cells(Irow, "H").Value
.Range("C13:E13").Value = Sht.Range("I" & Irow & ":K" & Irow).Value
.Range("C16").Value = Sht.Cells(Irow, "L").Value
End With
ThisWorkbook.Worksheets("档案卡").Copy
ActiveSheet.Name = Sht.Cells(Irow, "A").Value
ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path & "\" & Sht.Cells(Irow, "A").Value & ".xlsx"
ActiveWorkbook.Close
Next Irow
ThisWorkbook.Worksheets("档案卡").Range("C4:E4,C7:E7,C10:E10,C13:E13,C16").Value = ""
Application.ScreenUpdating = True
MsgBox "操作完成,单击【确定】按钮查看结果。", vbInformation
Shell "explorer.exe " & ThisWorkbook.Path & "\", vbNormalFocus
End Sub
上一篇:excel函数公式大全:将数组中的长数字信息转为文本 下一篇:excel怎么做表格:6个Excel实用技巧,一学就会
郑重声明:本文版权归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们修改或删除,多谢。