多表汇总目录指引

作者在 2015-12-23 20:33:04 发布以下内容
Set rng = Sheets("洗沫汇总表").Range("a1:e50")
rng.Select
Selection.Clear



 Sheets("洗沫汇总表").Cells(1, 1) = "部门"
     Sheets("洗沫汇总表").Cells(1, 2) = "金质"
     Sheets("洗沫汇总表").Cells(1, 3) = "金重"
     Sheets("洗沫汇总表").Cells(1, 4) = "报表编号"
     Sheets("洗沫汇总表").Cells(1, 5) = "表名"
   
         ii = 1
    
  For i = 1 To Sheets.Count
     ii = ii + 1
    If Sheets(i).Name = "洗沫汇总表" Then  '奔瑍猨蹲羆
        ii = ii - 1
    Else
      Sheets("洗沫汇总表").Cells(ii, 1) = Sheets(i).Cells(3, 2)

      Sheets("洗沫汇总表").Cells(ii, 2) = Sheets(i).Cells(5, 3)
    
         For j = 15 To 22
             If Sheets(i).Cells(j, 1) = "合计" Then
              Sheets("洗沫汇总表").Cells(ii, 3) = Sheets(i).Cells(j, 6).Value
             End If
         Next
     
      Sheets("洗沫汇总表").Cells(ii, 4) = Sheets(i).Cells(3, 8)
      
      Sheets("洗沫汇总表").Cells(ii, 5) = Sheets(i).Name

    End If
  Next
   
End Sub
          
        
          
        
VBA | 阅读 2520 次
文章评论,共0条
游客请输入验证码
浏览239586次
最新评论