以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  EXCEL中的多个sheet如何遍历?  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=66288)

--  作者:南望
--  发布时间:2015/4/2 16:54:00
--  EXCEL中的多个sheet如何遍历?

如何在下面代码中加入对EXCEL中的多个sheet的遍历?

        Dim Book1 As New XLS.Book(file)
        Dim Sheet1 = Book1.Sheets(0)
                    
            For i As Integer = 0 To Sheet1.Rows.Count-1
               
                For j As Integer = 0 To Sheet1.Cols.Count -1
                   
                    If Sheet1(i, j).Text > ""  AndAlso dic.ContainsKey(Sheet1(i, j).Text) Then
                            Sheet1(i, j).value = Sheet1(i, j).Text & vbcrlf & dic(Sheet1(i, j).Text)
                            
                Next
            Next

 

 



--  作者:有点甜
--  发布时间:2015/4/2 16:55:00
--  

For Each sheet1 As Object in Book1.Sheets

 

Next


--  作者:Bin
--  发布时间:2015/4/2 16:56:00
--  
for k as integer = 0 to Book1.Sheets.count-1
  Dim Sheet1 = Book1.Sheets(k)
next