Dim file2 As String
Dim x1 As Excel.Application
Dim x1sheet As Excel.Worksheet
Dim s(2 To 255) As String, y As String, i As Integer
y1 = Mid(Combo1.List(Combo1.ListIndex), 1, 4)
m1 = Mid(Combo2.List(Combo2.ListIndex), 1, 2)
If Combo1.List(Combo1.ListIndex) = "" Or Combo2.List(Combo2.ListIndex) = "" Then
MsgBox "請選擇年份月份", vbOKOnly, "注意"
Else
file1 = "e:\xue\" + (y1 + m1) + ".xls"
file2 = "e:\xue\re\re" + (y1 + m1) + ".xls"
End If
Set x1 = CreateObject("Excel.Application")
x1.Workbooks.Open file1
Set x1sheet = x1.Worksheets(1)
For i = 2 To 255
s(i) = x1sheet.Cells(i, 2)
y = TAX1(s(i))
Next i
x1sheet.Cells(i, 2) = y
x1.ActiveWorkbook.SaveAs file2
x1.Workbooks.Close
x1.Quit
MsgBox "保存完畢"
想達到的目的是讀取excel表第二列的逐行資料,然后套到tax1里面得到一個字,回傳寫入原位置,另存。
uj5u.com熱心網友回復:
麻煩高手解答下,謝謝了uj5u.com熱心網友回復:
求幫助,謝謝uj5u.com熱心網友回復:
寫了這么多代碼,哪句除錯有問題啊?說重點啊轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/129700.html
標籤:VB基礎類
上一篇:word 列印問題
