查看单个帖子
panmona
 
panmona 的头像
核心会员
 
资 料:
注册日期: Jan 2002
帖子: 3,537 声望值: 3
精华: 0,解答: 7
#4 旧 2012-11-14, 16:08:45 默认
panmona 当前在线  

代码:
    Set wb = Workbooks.Add
    wb.Sheets(1).Cells(1, 1) = "序号"
    wb.Sheets(1).Cells(1, 2) = "名称"
    wb.Sheets(1).Cells(1, 3) = "规格"
    wb.Sheets(1).Cells(1, 4) = "单位"
    wb.Sheets(1).Cells(1, 5) = "单价"
    wb.Sheets(1).Cells(1, 6) = "数量"
    wb.Sheets(1).Cells(1, 7) = "类型"
    
    i = 1
    While Len(Sheet1.Cells(i, 1)) > 0
        For j = 1 To 7
        wb.Sheets(1).Cells(i + 1, j) = Sheet1.Cells(i, j)
        Next
        i = i + 1
    Wend
    'wb.SaveAs 2
    wb.SaveAs ThisWorkbook.Path & "\2.xls"


Hello world!