|
- Sub tt()
- Dim ar, br, cr, i%, j%, pa, wb
- pa = ThisWorkbook.Path & "\上报.xls"
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- For Each f In Sheets
- If Len(f.Name) > 2 Then
- If f.Name = "资产表" Then
- Sheets(f.Name).Activate
- ar = [a1].CurrentRegion
- For i = 3 To UBound(ar)
- If ar(i, 2) <> "" And ar(i, 6) <> "" Then
- For j = 2 To UBound(ar, 2)
- If ar(i, j) = "" Then ar(i, j) = Format("0.00")
- Next j
- ElseIf ar(i, 2) = "" And ar(i, 6) <> "" Then
- For j = 7 To UBound(ar, 2)
- If ar(i, j) = "" Then ar(i, j) = "0.00"
- Next j
- ElseIf ar(i, 6) = "" And ar(i, 2) <> "" Then
- For j = 2 To 4
- If ar(i, j) = "" Then ar(i, j) = "0.00"
- Next j
- End If
- Next i
- ElseIf f.Name = "利润表" Then
- Sheets(f.Name).Activate
- br = [a1].CurrentRegion
- For i = 2 To UBound(br)
- If br(i, 2) <> "" Then
- For j = 3 To UBound(br, 2)
- If br(i, j) = "" Then br(i, j) = "0.00"
- Next j
- End If
- Next i
- ElseIf f.Name = "现金表" Then
- Sheets(f.Name).Activate
- cr = [a1].CurrentRegion
- For i = 2 To UBound(cr)
- If cr(i, 2) <> "" Then
- For j = 3 To UBound(cr, 2)
- If cr(i, j) = "" Then cr(i, j) = "0.00"
- Next j
- End If
- Next i
- End If
- End If
- Next f
- Set wb = Workbooks.Open(pa)
- For Each sh In wb.Sheets
- Sheets(sh.Name).Activate
- If sh.Name = "资产表" Then
- [a1].Resize(UBound(ar), UBound(ar, 2)) = ar
- ElseIf sh.Name = "利润表" Then
- [a1].Resize(UBound(br), UBound(br, 2)) = br
- ElseIf sh.Name = "现金表" Then
- [a1].Resize(UBound(cr), UBound(cr, 2)) = cr
- End If
-
- Next sh
- wb.Save
- wb.Close
- MsgBox "上报成功!", 1
- Application.ScreenUpdating = True
- Application.DisplayAlerts = True
- End Sub
复制代码 |
|