Board logo

¼ÐÃD: [µo°Ý] ¤@¦C¥u¯à¦³¤­­Ó¼Æ­È [¥´¦L¥»­¶]

§@ªÌ: wang077    ®É¶¡: 2021-6-21 16:48     ¼ÐÃD: ¤@¦C¥u¯à¦³¤­­Ó¼Æ­È

¥»©«³Ì«á¥Ñ wang077 ©ó 2021-6-21 16:51 ½s¿è

¦U¦ì¤j¯«½Ð°Ý
[attach]33436[/attach]
§Ú¦p¦ó¥ÎVBAôJ­ì¥»ª½ªº1~15
¨C¤­­Ó¼Æ­È±Æ¤@¦æ
§@ªÌ: samwang    ®É¶¡: 2021-6-22 08:32

¥»©«³Ì«á¥Ñ samwang ©ó 2021-6-22 08:33 ½s¿è

¦^´_ 1# wang077

¤£¦n·N«ä¹ï¤å¦r²z¸Ñ¤£¤Ó¦n¡A¬Ý¤F¦üÀ´«DÀ´¡A½Ð°Ý³W«h¬°¦ó? ¥i§_¦A¥[»¡©ú¸Ô²Ó©Îªþ¤W¸Ñµª¡AÁÂÁ¡C

¨C¤­­Ó¼Æ­È±Æ¤@¦æ: ¶Ã¼Æ¡A¥i­«½Æ...
§@ªÌ: samwang    ®É¶¡: 2021-6-22 11:17

¦^´_ 1# wang077

½Ð´ú¸Õ¬Ý¬Ý¡AÁÂÁ¡C

Sub test()
Dim Arr, Ar(1 To 3)
Arr = Range([a1], [a65536].End(3))
y = 2
For i = 1 To UBound(Arr)
    For j = 1 To 3
        N = N + 1: If N > UBound(Arr) Then GoTo 99
        Ar(j) = Arr(N, 1)
    Next
    Cells(1, y).Resize(3, 1) = Application.Transpose(Ar)
    y = y + 1
99: Next
End Sub
§@ªÌ: hcm19522    ®É¶¡: 2021-6-22 16:09

https://blog.xuite.net/hcm19522/twblog/589846795
§@ªÌ: wang077    ®É¶¡: 2021-6-22 19:14

¦^´_ 2# samwang
¥´¿ù¤F À³¸Ó¬O3­Ó¼Æ­È¤@¦æ¡AµM«á­­¨î³Ì¦h5¦æ¡A¼Æ­È¤£¤@©w¬O1¡ã15¡A¤W­±¹Ï¤ù¥u¬O¥Ü·N¹Ï
§@ªÌ: wang077    ®É¶¡: 2021-6-22 19:17

¦^´_ 4# hcm19522
¦³¿ìªk¨Ï¥Îvba¨Ó°µ¶Ü
§@ªÌ: samwang    ®É¶¡: 2021-6-22 19:45

¦^´_ 5# wang077


¤£¦n·N«ä¡A¯uªº¤£¯à²z¸Ñ±zªº»Ý¨D¡A©ÎªÌ±z¥i¥Hªþ¤W¦³¸ÑµªªºÀÉ®×¥B»¡©ú¸Ô²Ó±ø¥ó³W«h¡A·PÁ¡C
§@ªÌ: wang077    ®É¶¡: 2021-6-22 23:28

¦^´_ 3# samwang
For i = 1 To UBound(Arr)
³o¬qÅã¥Ü¸ê®Æ«¬ºA¿ù»~
§@ªÌ: wang077    ®É¶¡: 2021-6-22 23:35

¦^´_ 6# wang077
[attach]33442[/attach]
´N¬O¨Ò¦p¹Ï¤ù
§ÚAÄ椤ªº¼Æ­È
­n§â¥¦¤À¦¨¤­¦æ¨Ó±Æ¦C
±Æ¦C¤è¦¡A1:A3ªº¼Æ­È¦bB1:B3
A4:A6ªº¼Æ­È¦bC1:C3
¥H¦¹Ãþ±À¡C
§@ªÌ: samwang    ®É¶¡: 2021-6-23 07:17

¦^´_ 9# wang077


3¼Óµ{¦¡½X¨S°ÝÃD¦pªþ¥ó¡A½Ð¦A´ú¸Õ¬Ý¬Ý¡AÁÂÁ¡C
§@ªÌ: wang077    ®É¶¡: 2021-6-23 15:34

¦^´_ 10# samwang
¤j¯«
[attach]33448[/attach]
¦pªGAÄæ¼Æ­È¦³N­Ó©O?
¦Ó¥B³Ì¦h±Æ5­ÓÄæ¦ì¦Ó¤w
§@ªÌ: samwang    ®É¶¡: 2021-6-23 16:47

¦^´_ 11# wang077

½Ð¦A´ú¸Õ¬Ý¬Ý¡AÁÂÁÂ

Sub test1()
Dim Arr, Ar(1 To 3)
Arr = Range([a1], [a65536].End(3))
x = 1: y = 2
For i = 1 To UBound(Arr)
    For j = 1 To 3
        N = N + 1: If N > UBound(Arr) Then GoTo 99
        Ar(j) = Arr(N, 1)
    Next
    Cells(x, y).Resize(3, 1) = Application.Transpose(Ar)
    If y < 6 Then y = y + 1 Else x = x + 3: y = 2
99: Next
End Sub
§@ªÌ: wang077    ®É¶¡: 2021-6-23 16:54

¦^´_ 12# samwang
¤j¯«¡A¥i¯à§Úªí¹F¤£²M·¡
§Úªº·N«ä¬OA1:A4ªº¼Æ­È¦bB1:B4
A5:A8ªº¼Æ­È¦bC1:C4
A9:A12ªº¼Æ­È¦bD1:D4
A13:A16ªº¼Æ­È¦bE1:E4
A17:A20ªº¼Æ­È¦bF1:F4
§@ªÌ: samwang    ®É¶¡: 2021-6-23 17:24

¦^´_ 13# wang077


¦]¬°±zªº³W«h¤£©ú½T¦³°ÝÃD¡A²{¦b»Ý¨DAÄæ¦ì¥u¨ì20µ§
¦pªGAÄæ¦ì°²³]¶W¹L20µ§¥H«á¡A­n«ç»ò³B²z??
§@ªÌ: wang077    ®É¶¡: 2021-6-23 18:28

¦^´_ 14# samwang
´N¬O¤£ºÞAÄ榳´Xµ§¸ê®Æ
³Ì¦h¥u¯à¥Î5­ÓÄæ¦ì¨Ó±Æ§Ç
¤]´N¬OB-FÄæ
§@ªÌ: samwang    ®É¶¡: 2021-6-23 20:29

¦^´_ 15# wang077

½Ð¦A´ú¸Õ¬Ý¬Ý¡AÁÂÁÂ

Sub test2()
Dim Arr, Ar(), N%, M%, x%, y%
Arr = Range([a1], [a65536].End(3))
M = Int(UBound(Arr) / 5): x = 1: y = 2
If M < 1 Then
    Cells(x, y).Resize(, UBound(Arr)) = Application.Transpose(Arr)
Else
    For i = 1 To UBound(Arr)
        ReDim Ar(1 To M)
        If N = UBound(Arr) Then GoTo 99
        If N = M * 5 Then
            ReDim Ar(1 To UBound(Arr) - N)
            For j = 1 To UBound(Arr) - N: N = N + 1: Ar(j) = Arr(N, 1): Next
            Cells(x, y).Resize(, UBound(Ar)) = Ar: Exit For
        End If
        For j = 1 To M: N = N + 1: Ar(j) = Arr(N, 1): Next
        Cells(x, y).Resize(UBound(Ar), 1) = Application.Transpose(Ar)
        Erase Ar
        If y < 6 Then y = y + 1 Else x = x + M: y = 2
99: Next
End If
End Sub
§@ªÌ: wang077    ®É¶¡: 2021-6-23 20:57

¦^´_ 16# samwang
´ú¸Õ¹L¤F¡A¨S°ÝÃD¡C
·PÁ¤j¯«À°¦£¡A¨¯­W¤F¡C
§@ªÌ: wang077    ®É¶¡: 2021-6-25 09:31

¦^´_ 16# samwang
Sub Openfile()
fileToOpen = Application _
        .GetOpenFilename("Excel Files(*.csv*), *.csv*", MultiSelect:=True)
        num = 0
        linenumber = 0
    For num1 = 1 To UBound(fileToOpen)
    num = num + 1
    If fileToOpen(num) <> "False" Then
    Open fileToOpen(num) For Input As #1 ' Open file for input
    Do While Not EOF(1) ' Loop until end of file
        linenumber = linenumber + 1
        Line Input #1, line
        arrayOfElements = Split(line, ",")
        elementnumber = 0
        For Each element In arrayOfElements
            elementnumber = elementnumber + 1
            Cells(linenumber, elementnumber).Value = element
        Next
    Loop
    End If
Close #1 ' Close file.
Next num1
End Sub
³o¬O§Úªºµ{¦¡½X¡A¶}¥X¨ÓªºcsvÀɳ£¬O¶Ã½X
¥Î¤F¿ý¼v¥¨¶°
µo²{¸òTextFilePlatform¦³Ãö
¤j¯«¥i¥HÀ°§Ú¶Ü
§@ªÌ: samwang    ®É¶¡: 2021-6-25 09:44

¦^´_ 18# wang077

¤£¦n·N«ä¡A¤£¤Ó¼ô±xCSVÀɮ׳o³¡¤À¡A«Øij¥i¥H¨ìExcel µ{¦¡°Ïµo¤å¡A¨ºùØ°ÝÃD¤ñ¸û¦h¤H¦bÃöª`©Î³\¥i¸Ñ±zªº°ÝÃD¡A·PÁ¡C
§@ªÌ: wang077    ®É¶¡: 2021-6-25 09:54

¦^´_ 19# samwang
¦nªº¡A·PÁ±z
§@ªÌ: samwang    ®É¶¡: 2021-7-19 14:39

¦^´_ 18# wang077

¥i¥Hªþ¤WÀɮסA§ÚÀ°¦£¬Ý¬Ý¬O§_¦³¸Ñ¡AÁÂÁÂ




Åwªï¥úÁ{ ³Â»¶®a±Ú°Q½×ª©ª© (http://forum.twbts.com/)