本文主要是介绍excell宏,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
Sub crea_detail()
'
' crea_detail Macro
' 宏由 微软用户 录制,时间: 2008-11-3
'
'
mxrow = 2
For counter = 1 To 31
For irow = 4 To 1000
If Worksheets(counter).Cells(irow, 2).Value = "" Then
Exit For
End If
If Worksheets(counter).Cells(irow, 1).Value <> "" Then
Worksheets("当月总明细").Cells(mxrow, 1).Value = Worksheets(counter).Cells(irow, 1).Value
Worksheets("当月总明细").Cells(mxrow, 2).Value = Worksheets(counter).Cells(irow, 2).Value
Worksheets("当月总明细").Cells(mxrow, 3).Value = Worksheets(counter).Cells(irow, 3).Value
Worksheets("当月总明细").Cells(mxrow, 4).Value = "10月" & Right("00" & Trim(Str(32 - counter)), 2) & "日"
Worksheets("当月总明细").Cells(mxrow, 5).Value = Worksheets(counter).Cells(irow, 5).Value
Worksheets("当月总明细").Cells(mxrow, 6).Value = Worksheets(counter).Cells(irow, 6).Value
Worksheets("当月总明细").Cells(mxrow, 7).Value = Worksheets(counter).Cells(irow, 7).Value
Worksheets("当月总明细").Cells(mxrow, 8).Value = "=lookup(G" & Trim(Str(mxrow)) & ",wd!$A2:$A187,wd!$D2:$D187)"
mxrow = mxrow + 1
End If
Next irow
Next counter
End Sub
这篇关于excell宏的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!