- 帖子
- 39
- 主題
- 15
- 精華
- 0
- 積分
- 69
- 點名
- 0
- 作業系統
- Windows 7
- 軟體版本
- office 2016
- 閱讀權限
- 20
- 性別
- 男
- 來自
- 新北市
- 註冊時間
- 2018-11-23
- 最後登錄
- 2020-2-26
 
|
8#
發表於 2019-7-23 10:08
| 只看該作者
本帖最後由 show5217 於 2019-7-23 10:20 編輯
回復 7# 准提部林
謝謝, 指教了. 我是用下面這種方法
new_id = s_id
n = n + 1
Sheet1.Cells(n, "n") = s_id
txt_str = txt_str & Space(7 - Len(s_id)) & s_id
If Sheet1.Cells(i, "f") <> "" Then
Sheet1.Cells(n, "o") = Sheet1.Cells(i, "f")
txt_str = txt_str & Space(1) & Sheet1.Cells(n, "o") & Space(21 - Len(Sheet1.Cells(n, "o")))
j = j + 1
txt_str = txt_str & Space(22)
If Sheet1.Cells(i, "e") = "" Then
Sheet1.Cells(n, "q") = "-"
Else
Sheet1.Cells(n, "q") = Sheet1.Cells(i, "e")
End If
txt_str = txt_str & Sheet1.Cells(n, "q") & Space(2)
Set Rng = Sheet2.Range("a:a").Find(Sheet1.Cells(i, "g"), lookat:=xlWhole)
If Not Rng Is Nothing Then
r = Rng.Row
supply = Sheet2.Cells(r, "b")
Else
supply = Sheet1.Cells(i, "g")
End If
Sheet1.Cells(n, "r") = supply
txt_str = txt_str & supply & Space(40 - Len(supply))
Sheet1.Cells(n, "s") = Sheet1.Cells(i, "h")
txt_str = txt_str & Sheet1.Cells(n, "s") & Space(5 - Len(Sheet1.Cells(n, "s")))
End If
txt_str = txt_str & vbCrLf |
|