ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ¿ï¾ÜÀÉ®×Âন¤å¦rÀÉ°ÝÃD.

¦^´_ 1# dou10801


    ¥H¤U¬O½m²ßªº¤è®×,½Ð«e½ú°Ñ¦Ò

Option Explicit
Sub «ö¶s1_Click()
Application.DisplayAlerts = False
Dim MyFile, Arr, Brr$(), p2%, myPath$, R&, Q, MDS$(2 To 4), Nm$, Sc%, mcs1$, mcs2$
MyFile = Application.GetOpenFilename("ExcelÀÉ,*.XLS*")
If MyFile = "False" Then Exit Sub
Q = Split([B6], ",")
myPath = ThisWorkbook.Path & "\"
mcs1 = [B1] & Mid([B2], 2, 6) & [B3] & [B4]
mcs2 = [B5]: Sc = Val([B7])
With Workbooks.Open(MyFile, , True)
   Nm = .Name
   If Sc > .Worksheets.Count Then MsgBox Nm & " ¬¡­¶Ã¯¨S¦³²Ä" & Sc & " ­Óªí": .Close 0: Exit Sub
   With .Sheets(Sc)
      If Not .AutoFilter Is Nothing Then If .FilterMode = True Then .ShowAllData
      Arr = Range(.[G1], .[A65536].End(3))
   End With
   .Close 0
End With
If UBound(Arr) = 1 Then MsgBox Nm & " ¬¡­¶Ã¯²Ä" & Sc & " ­Óªí¨S¦³¸ê®Æ": Exit Sub
ReDim Brr(1 To UBound(Arr) - 1, 1 To 1)
For R = 2 To UBound(Arr)
   If Arr(R, 3) <> "" Then
      p2 = 29 - Len(Arr(R, Val(Q(2))))
      MDS(2) = Arr(R, Val(Q(0)))
      MDS(3) = Format(Arr(R, Val(Q(1))), "00000000000")
      MDS(4) = Arr(R, Val(Q(2)))
      Brr(R - 1, 1) = mcs1 & MDS(2) & MDS(3) & "00" & mcs2 & MDS(4) & String(p2, " ")
   End If
Next R
Workbooks.Add
[A1].Resize(UBound(Arr) - 1, 1) = Brr
Nm = StrReverse(Mid(StrReverse(Nm), InStr(StrReverse(Nm), ".") + 1))
ActiveWorkbook.SaveAs myPath & Nm & ".TXT", 42
ActiveWindow.Close
ThisWorkbook.Activate
MsgBox "²£¥Í´CÅéÀÉ:" & myPath & Nm & ".TXT"
End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦^´_ 15# dou10801


   
      Arr = .[A1].CurrentRegion
      'brr = .[A1].CurrentRegion
      ReDim brr(1 To UBound(Arr), 1 To 1)
      'MsgBox UBound(Arr)
      For R = 1 To UBound(Arr)
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦^´_ 14# Andy2483
¥H¿ï22.XLSX,²Ä3¤u§@ªí¬°¨Ò,¥½µ§¸ê®Æ,[¦X­p]¦r¼Ë¬°¦ó®³¤£±¼.½Ð«e½ú«üÂI,ÁÂÁÂ.
If Cells(R, 3) <> "" Then    '¤w§PÂ_CÄæªÅ¥Õ¤£¥[¤JBRR(),¦ý²£¥ÍÀÉÁÙ¬O¦³[¦X­p]¦r¼Ë.
            p1 = Len(Cells(R, MDS4))  '³ÆµùÄæªø«×.
            p2 = 29 - p1              '¸ÉªÅ¥Õªø«×
            mcs = "" & mcs1 & Cells(R, MDS2) & Format(Cells(R, MDS3), "00000000000") & "00" & mcs2 & Cells(R, MDS4) & String(p2, " ")
            brr(R, 1) = mcs
          End If
§ù¤p¥­

TOP

¦^´_ 13# dou10801


    ±N¨C­ÓÅܼƳ£°µ«Å§i ¥i¥HÅýÅÞ¿è§ó²M·¡,«Øij¾i¦¨²ßºD
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦^´_ 12# Andy2483
¤èªk1.:
With Workbooks.Open(xlsPath, , True).Sheets(Val(MP1))
"3"¬O¦r¦ê,«ü©w3¯Á¤Þ¸¹¤u§@ªí¥²¶·±N¦r¦ê "3" Âà¤Æ¬°¼Æ­È 3

¤èªk2.:
«Å§i¬°µu¾ã¼Æ:
Dim MP1%
MP1 = Range("B7")
With Workbooks.Open(xlsPath, , True).Sheets(MP1)

mcs = "'" & mcs1 & Cells(R, MDS2) & Format(Cells(R, MDS3),~~

With Workbooks.Open(xlsPath, , True).Sheets(2)
    .Activate
  .Cells.NumberFormatLocal = "@"

¦¹¦¸°Ýµª,·PÁ«e½ú,¤£§[½ç±Ð«ü¾É,¾Ç¨ì«Ü¦h¤p²Ó¸`,·P®¦·P®¦.
§ù¤p¥­

TOP

¦^´_ 11# dou10801


   
With Workbooks.Open(xlsPath, , True).Sheets(2)
       .Activate
      .Cells.NumberFormatLocal = "@"
      Arr = .[A1].CurrentRegion
      brr = .[A1].CurrentRegion

¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¥»©«³Ì«á¥Ñ dou10801 ©ó 2023-10-30 13:51 ½s¿è

¦^´_ 10# Andy2483
With Workbooks.Open(xlsPath, , True).Sheets(2)
1.¿ï¨ú22.XLSX¬°¨Ò.
2,·|²£¥Í[¤u§@ªí¤@]ªº¸ê®Æ,¥B¤£¬O¦r¦ê²Õ¦X.
mcs = "" & mcs1 & Cells(R, MDS2) & Format(Cells(R, MDS3), "00000000000") & "00" & mcs2 & Cells(R, MDS4) & String(p2, " ")

22txt.jpg (41.44 KB)

22txt.jpg

¤u§@ªí1.jpg (167.11 KB)

¤u§@ªí1.jpg

¤u§@ªí2.jpg (153.34 KB)

¤u§@ªí2.jpg

§ù¤p¥­

TOP

¦^´_ 9# dou10801


    With Workbooks.Open(xlsPath, , True).Sheets(2) °õ¦æµ²ªG «ç¼Ë¤£¦æ?
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦^´_ 8# Andy2483
With Workbooks.Open(xlsPath, , True).Sheets(1)
      .Cells.NumberFormatLocal = "@"
¨ú²Ä¤@¤u§@ªí¥¿±`¤F.


With Workbooks.Open(xlsPath, , True).Sheets(2)    ©Î   With Workbooks.Open(xlsPath, , True).Sheets(val(mp1)
      .Cells.NumberFormatLocal = "@"
³o­ÓÁÙ¬O¤£¦æ...........
§ù¤p¥­

TOP

¦^´_ 7# dou10801


   
With Workbooks.Open(xlsPath, , True).Sheets(1)
      .Cells.NumberFormatLocal = "@"
      Arr = .[A1].CurrentRegion
      brr = .[A1].CurrentRegion
~~
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

        ÀR«ä¦Û¦b : µêªÅ¦³ºÉ¡D§ÚÄ@µL½a¡AµoÄ@®e©ö¦æÄ@Ãø¡C
ªð¦^¦Cªí ¤W¤@¥DÃD