返回列表 上一主題 發帖

[發問] MID抓取資料0不見問題請教

With Sheets("" & Sheet1.Range("A1") & ".nd")
     .Cells(Y + 1, 4) = Sheet1.Cells(1, 2)
     .Cells(Y + 1, 5) = Sheet1.Cells(1, 3)
     .Cells(Y + 1, 6) = Sheet1.Cells(1, 4)
     .Cells(Y + 1, 7) = "'" & Mid(.Cells(M, 1), 2, 9) '加單引號為文字格式
End With

TOP

或者:
With Sheets("" & Sheet1.Range("A1") & ".nd")
     .Cells(Y + 1, 4) = Sheet1.Cells(1, 2)
     .Cells(Y + 1, 5) = Sheet1.Cells(1, 3)
     .Cells(Y + 1, 6) = Sheet1.Cells(1, 4)
     .Cells(Y + 1, 7).NumberFormatLocal = "@" '文字格式
     .Cells(Y + 1, 7) = Mid(.Cells(M, 1), 2, 9)
End With

最好先將整欄設為[文字格式], 不必在程式碼去處理, 多耗資源~~

TOP

        靜思自在 : 不要小看自己,因為人有無限的可能。
返回列表 上一主題