[問題] VBA 超過65535放到Sheet2
(若是和其他不同軟體互動之問題 請記得一併填寫)
軟體:Excel
版本:Office 2010
如何改寫為當讀取超過65535時 , 寫到Sheet2 , 3 , 4.............
以下是程式碼
Sheets("Sheet1").Select
'-----------------------------------------------------
Application.ScreenUpdating = False
Do
If xChk = 0 Then
xFile = Dir(ThisWorkbook.Path & "\*.csv")
If xFile = "" Then MsgBox "※找不到 CSV 檔案! ", 0 + 16: Exit Sub
xChk = 1
Else
xFile = Dir
If xFile = "" Then Exit Do
End If
'----------------------------------------------
uFile = ThisWorkbook.Path & "\" & xFile
Set uHead = Range("A65536").End(xlUp)
uHead.Value = xFile
Set uHead = uHead(2, 1)
With ActiveSheet.QueryTables.Add(Connection:="TEXT;" & uFile, Destination:=uHead)
.AdjustColumnWidth = False
.TextFileOtherDelimiter = ":" '冒號
.TextFileCommaDelimiter = True '逗號
.Refresh BackgroundQuery:=False
.Delete
End With
uHead.Interior.ColorIndex = 6 '每筆第一格加〔黃色〕底
NEXT_LINE:
Loop
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 123.241.96.6
※ 文章網址: https://www.ptt.cc/bbs/Office/M.1487161425.A.8EF.html
→
02/15 20:46, , 1F
02/15 20:46, 1F
→
02/15 20:48, , 2F
02/15 20:48, 2F
→
02/15 20:48, , 3F
02/15 20:48, 3F
→
02/15 20:52, , 4F
02/15 20:52, 4F
→
02/15 21:01, , 5F
02/15 21:01, 5F
→
02/15 21:01, , 6F
02/15 21:01, 6F
→
02/15 21:53, , 7F
02/15 21:53, 7F
→
02/15 22:00, , 8F
02/15 22:00, 8F
→
02/15 22:00, , 9F
02/15 22:00, 9F
→
02/20 21:22, , 10F
02/20 21:22, 10F
→
02/20 21:28, , 11F
02/20 21:28, 11F
→
02/22 07:31, , 12F
02/22 07:31, 12F
Office 近期熱門文章
PTT數位生活區 即時熱門文章