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

[µo°Ý] ¦Û°Ê®Mªí

¥»©«³Ì«á¥Ñ PJChen ©ó 2019-11-25 22:43 ½s¿è

¦^´_ 12# ­ã´£³¡ªL

­ã¤j¦n,
§Ú¨Ì²{¦æªº´ú¸ÕÀÉ,§âµ{¦¡­×§ïÀɦW«á
µ{¦¡´ú¸Õµ²ªG¯d¦b¼t¯Êªí¤¤(¤£¬O ¦Û°Ê¼t¯Êªí)
¥¦»P8¼Óªºµ{¦¡´ú¸Õ¬Û¦P,·í"­¸¤ñ"sheet¦³­q³æ¼Æ¾Ú®É,
­q³æ¸ê®Æ·|³s¦P¼t¯Ê,¤@°_§e²{¦b¼t¯Êªí¤¤
¦A³Â·Ð¬Ý¤U, ·PÁÂ
3rd_µ{¦¡»P°õ¦æÀÉ ¤À¶}_amd.rar (255.3 KB)

TOP

¦^´_ 12# ­ã´£³¡ªL

·PÁ­ã¤j,
¦h¤Ñ¨Ó ²{¦b¤~¦³ªÅ¥i¥H¤Wºô¬d¬Ý, ³o´X¤Ñ¦]¬°¦³·s¤u§@,²ÖÀŤF....
µ¥§Ú´ú¸Õ¤U¦A³ø§i

TOP

°µ­Ó¸óÀÉ°õ¦æ, ¦Û¦æ­×§ï®M¥Î:
¼t¯Ê.rar (40.53 KB)

TOP

Sub ¸ü¤J()
Dim S1 As Worksheet, S2 As Worksheet, Rng1 As Range, Rng2 As Range
Dim Arr, R&, C&, Ck%, N&, xR As Range
Set S1 = Sheets("¼t¯Êªí"):   Set S2 = Sheets("¥X³f")
Set Rng1 = S1.[B3:G3]:   Set Rng2 = S1.[B4:H4]:   Set xR = S1.[B3]
Application.ScreenUpdating = False
Call ²M°£
Arr = Range(S2.[a1], S2.UsedRange)
For C = 45 To UBound(Arr, 2)
    Ck = 0
    For R = 4 To UBound(Arr)
        If Val(Arr(R, C)) <= 0 Then GoTo 101
        If Ck = 0 Then
           Rng1.Copy xR
           xR.Resize(1, 6).VerticalAlignment = xlCenter '¸óÄæ¸m¤¤
           xR = Arr(3, C) '¼t¯Ê¦WºÙ
           Set xR = xR(2): Ck = 1
        End If
        '----------------------------
        Rng2.Copy xR
        xR.Resize(1, 4) = Array(Arr(R, 8), "", Arr(R, 7), Arr(R, C))
        xR(1, 7) = Arr(R, 5)
        Set xR = xR(2): N = N + 1
101: Next R
Next C
If N = 0 Then Exit Sub
Rng2.Copy xR(2)
xR(2).Resize(1, 7).ClearContents
xR(2).Resize(1, 6).Interior.ColorIndex = 37
xR(2, 4).Resize(1, 3) = "=SUM(R[-" & xR.Row - 3 & "]C:R[-1]C)"
End Sub

Sub ²M°£()
With Sheets("¼t¯Êªí")
    .UsedRange.Offset(4, 0).EntireRow.Delete
    .[B3] = ""
    .[B4:G4].ClearContents
    .[F4] = "=IF(MIN(D4:E4)=0,"""",INT(E4/D4))"
    .[G4] = "=IF(MIN(D4:E4)=0,"""",MOD(E4,D4))"
    .[H3:H4].ClearContents
End With
End Sub

Xl0000142.rar (26.85 KB)

­Y»Ý¸óÀÉ, ¦Û¦æ¥h­×§ï~~

===========================================

TOP

¥»©«³Ì«á¥Ñ luhpro ©ó 2019-11-20 22:31 ½s¿è
¦^´_  luhpro

¤j¤j,
¦³¯Ê³fªº³¡¥÷¡A¨Ì§Ç±q"­¸¤ñ"AS:BH±a¸ê®Æ,
´ú¸ÕÀɤ¤ªº¯Ê³f¨ä¹ê¥u¦³¤@¶µ(72²~), ...
PJChen µoªí©ó 2019-11-20 21:03


¶â? ÁÙ¬O¸ò¤§«e¤@¼Ë·|µo¥Í¿ù»~¶Ü?
8# ¥D­n¬O¸Ñ¨M ""(ªÅ¦r¦ê) »P "½c+" ³y¦¨­pºâ¿ù»~ªº°ÝÃD,
¤£¹L¨Ì§A©Ò­z¨º¨ä¹ê¬O§A¨S­n§ì¨úªº³¡¤À.
©Ò¥H§AÅܦ¨¥u­n§â 7# ªºµ{¦¡­×§ï³o¤@¦æÀ³¸Ó´N¬O§A­nªºµ²ªG¤F :
    iCol = 45 '¼t¯Ê¨Ó·½°_©lÄæ
    While .Cells(3, iCol) <> "¹º³æ¦X­p"
      sStr = .Cells(3, iCol) ' ¾ÚÂI¦W

¤£¹L³o­Ó¤´µM­n§ï :
sFlName = "³Ì·s®w¦s.xlsx"
  Set wsSou = Workbooks(sFlName).Sheets("­¸¤ñ")
  Set diPro = CreateObject("Scripting.Dictionary") ' °Ó«~¯Ê¼Æ
¬õ¦â³o¤@¦æ­n²¾¨ì³o¸Ì :
End If
    Set wsSou = Workbooks(sFlName).Sheets("­¸¤ñ")
   With wsSou ' Ū¨ú­¸¤ñ¸ê®Æ

¥t¥~, ³o¦æ¤]­n­×§ï :
  With wsTar ' ²£¥Í¼t¯Êªí
    .Range(.[A3], .Cells(Rows.Count, 8)).Delete Shift:=xlShiftUp
    lRow = 3

¥t¥~¤]·Q½Ð°Ý,¤é«á­Y¥X³f¾ÚÂI¼W¥[®É,"­¸¤ñ"AS:BHÄæ¼Æ¤]·|¼W¥[,½Ð°Ý·í¾ÚÂI¼W¥[®É­n¦p¦ó­×§ï?

­n¥[¤W¾ÚÂI,
¥u­n¦b "¹º³æ¦X­p" (§Y BI Äæ)¥ª¤è´¡¤J¾ãÄæ¨Ã½á»P¸ê®Æ§Y¥i.

TOP

¦^´_ 8# luhpro

¤j¤j,
´ú¸Õ«á."¦ü¥G"¬Ý¤£¥X¦³§ïÅÜ吔...
¦³¯Ê³fªº³¡¥÷¡A¨Ì§Ç±q"­¸¤ñ"AS:BH±a¸ê®Æ,´ú¸ÕÀɤ¤ªº¯Ê³f¨ä¹ê¥u¦³¤@¶µ(72²~)
¥i¬O»sªí§¹¦¨«á·|§â­q³æªº¼Æ¶q±a¨ì¼t¯Ê!!
¥t¥~¤]·Q½Ð°Ý,¤é«á­Y¥X³f¾ÚÂI¼W¥[®É,"­¸¤ñ"AS:BHÄæ¼Æ¤]·|¼W¥[,½Ð°Ý·í¾ÚÂI¼W¥[®É­n¦p¦ó­×§ï?

TOP

¥»©«³Ì«á¥Ñ luhpro ©ó 2019-11-20 00:01 ½s¿è
¦^´_  luhpro

SOS
¤j¤j,
§Ú¨Ì¹ê»Ú»Ý¨D,¤p¤pªº§ï¤Fµ{¦¡,´ú¸Õ®É¤]³£¨S°ÝÃD,¦ý...
µ{¦¡¦b¥¿¦¡¨Ï¥Î®É,µo ...
PJChen µoªí©ó 2019-11-19 22:01

­º¥ý­×¥¿¤@­Ó¿ù»~, ¬õ¦â³o¤@¦æ­n²¾¨ì³o¸Ì :
  End If
    Set wsSou = Workbooks(sFlName).Sheets("­¸¤ñ")
  With wsSou ' Ū¨ú­¸¤ñ¸ê®Æ
§Ú­Ì¤£¯à¦b "³Ì·s®w¦s.xlsx" ³o­ÓÀÉ®×ÁÙ¨S¥´¶}«e´N¥h°Ñ·Ó¥¦.

¨ä¦¸¦^µª§Aªº°ÝÃD,
¨º¦æ¦³°ÝÃD¬O¦]¬° vD2(1) ¬O ªÅ¦r¦ê (§Y "" ),
¨t²Î¤£±µ¨ü±N¥¦¥Î¨Ó°Ñ»P­pºâ¦¡.
¦A¦Ò¼{¨ì§Aªº¤í²~¼Æ·|¥X²{¤é´Á,
©Ò¥H§Ú±q·½ÀYª½±µÂo±¼¤£²Å¦X¼Æ¦r®æ¦¡ªº¸ê®Æ :
  Dim rTar As Range
...
      sStr = .Cells(3, iCol) ' ¾ÚÂI¦W
      lRow = 4 '°Ó«~°_©l¦C
      While .Cells(lRow, 8) <> "" ' °Ó«~¦WºÙ
        Set rTar = .Cells(lRow, iCol)
        If rTar > 0 And rTar <> "" And InStr(1, rTar, "/") = 0 Then
          If diPro.Exists(sStr) Then
            diPro(sStr) = diPro(sStr) & "," & lRow & "-" & rTar
...
        vD2 = Split(vD1(iI), "-")
        sStr = vD2(1)
...
        .Cells(lRow, 5) = sStr ' ¤í²~¼Æ
        '.Cells(lRow, 6) = Int(vD2(1) / .Cells(lRow, 4)) ' ½c <= §R°£³o¦æ
        If InStr(1, sStr, "½c") > 0 Then ' ³B²z¦³ "½c+" ªº¦r¦ê
          .Cells(lRow, 6) = Left(sStr, InStr(1, sStr, "½c") - 1) ' ½c
          .Cells(lRow, 7) = Val(Mid(sStr, InStr(1, sStr, "½c") + 1)) ' ²~
        Else ' ¥¿±`ªº²~¼Æ
          .Cells(lRow, 6) = Int(sStr / .Cells(lRow, 4)) ' ½c
          .Cells(lRow, 7) = sStr Mod .Cells(lRow, 4) ' ²~
        End If

³Ì«á, ¦]¬°¦³ "½c+" ªº¦r¦ê¤Óªø¤£¯à¥þ³¡Åã¥Ü¥X¨Ó,
¬G½Õ¾ã E ÄæÄæ¼e :
    .Columns("E").AutoFit
  End With
  MsgBox "¯Ê®Æ©ú²Ó¤w²£¥Í§¹²¦..."
Macro-2.zip (21.63 KB)

TOP

¦^´_ 5# luhpro

SOS
¤j¤j,
§Ú¨Ì¹ê»Ú»Ý¨D,¤p¤pªº§ï¤Fµ{¦¡,´ú¸Õ®É¤]³£¨S°ÝÃD,¦ý...
µ{¦¡¦b¥¿¦¡¨Ï¥Î®É,µo¥Í¤F°ÝÃD
°±¦b³o¸Ì ".Cells(lRow, 6) = Int(vD2(1) / .Cells(lRow, 4)) ' ½c"
¦Ó¥B¶]¥X¤@¨Ç´ú¸Õ®É¥¼´¿¥X²{ªº¸ê®Æ,
§Ú§â¥¦¯d¦b°õ¦æµ²ªG¤¤,
½ÐÀ°¦£¬Ý¤U....·PÁÂ
3rd_µ{¦¡»P°õ¦æÀÉ ¤À¶}.rar (136.08 KB)

TOP

¦^´_ 5# luhpro

·PÁÂ ¤j¤j,
°õ¦æ¨S¦³°ÝÃD¤F

TOP

¥»©«³Ì«á¥Ñ luhpro ©ó 2019-11-17 01:17 ½s¿è
¦^´_  luhpro

½Ð°Ý¤j¤j,
¤@¯ë§Ú¦b¥ÎVBA®É,¥ÎAlt + F11´N¥i¥H¬Ý¨ìModuleªºµ{¦¡½X,¬°¤°»ò±z¼gªºµ{¦¡¬Ý¤£¨ìModule ?

PJChen µoªí©ó 2019-11-16 23:12

¨º¥u¬O§Ú­Ìªº¤Á´«¤è¦¡¤£¦P,
§A¥u­nÂI¤@¤U¦p¤U¹Ïªº "À˵øµ{¦¡½X" «ö¶s´N¥i¥H¬Ý¨ì¤F.
À˵øµ{¦¡½X«ö¶s.jpg

¥t¥~¦]¬°ªí®æ¤@¶}©lªºª¬ºA³£¬OªÅ¥Õªº,¶ñ¤J¸ê®Æ®É­n±q²Ä3¦C¶}©l,¦ý¦b´ú¸Õ®É³£·|±q²Ä6¦C¶}©l¶ñ,¥i§_À°¦£§ï¬°°_©l¥Ñ²Ä3¦C¶}©l¼g¤J¸ê®Æ?

¦]¬°§Aªº½d¨Ò¾×¬Ý¨ìªº¬O±q²Ä6¦C¶}©lªº.(ÁôÂäF²Ä3-5¦C)
»Ý­n­×§ï©³¤U³o¦æ¼Æ¦r :
    With wsTar ' ²£¥Í¼t¯Êªí
    .Range(.[A6], .Cells(Rows.Count, 8)).Delete Shift:=xlShiftUp

    lRow = 3
    For Each vA In diPro
ÁÙ¦³©³¤U³o¦æ :
    lRow = lRow - 1
    With .Range(.[B3, .Cells(lRow, 7))
       .Borders(xlEdgeLeft).LineStyle = xlContinuous

¥t¥~§Úªºµ{¦¡­n©ñ¦b¥t¤@ÀÉ®×Macro.xlsm¤¤°õ¦æ,¨Ã«ü©wÀɦW"³Ì·s®w¦s.xlsx"½Ð°Ýµ{¦¡­n«ç»ò­×¥¿?

  Dim sStr$, sPath$, sFlName$
...
  Set wsSou = ThisWorkbook.Sheets("¥X³f")
  Set wsTar = Sheets("¼t¯Êªí")  <=§R±¼³o¦æ
  Set diPro = CreateObject("Scripting.Dictionary") ' °Ó«~¯Ê¼Æ  
   sPath = ThisWorkbook.Path ' ¦pªG­n«ü©w¥Ø¿ý, ¥u­n§ï¦¨¸Ó¥Ø¿ý§Y¥i, ¦p sPath = "D:"
  sFlName = "³Ì·s®w¦s.xlsx"
  bMatch = False ' Àˬd '³Ì·s®w¦s.xlsx' Àɮ׬O§_¤w¶}±Ò
  For iI = 1 To Workbooks.Count
    If Workbooks(iI).Name = sFlName Then
      bMatch = True
      Exit For
    End If
  Next iI
  If bMatch Then
    Set wsTar = Workbooks(sFlName).Sheets("¼t¯Êªí")
    wsTar.Activate
  Else
    Set wsTar = Workbooks.Open(Filename:=sPath & "\" & sFlName).Sheets("¼t¯Êªí")
  End If

³Ì«á, ­ì¥ýªºÀɮפ¤,
¦r§Î¤j¤p»P½c¤J¼ÆÃC¦â§Ñ¤F§ï,
´N¤@¨Ö³B²z¤F :
     With .Range(.[B3], .Cells(lRow, 7))
      .Font.Size = 18
   ...
    End With
    For Each vA In diTit
...
    Next

    With .Range(.[D3], .Cells(lRow, 3))
      .Font.ColorIndex = 23
    End With


­×§ï«á§¹¾ãµ{¦¡¦p¤U :
Private Sub CbCreat_Click() ' ²£¥Í©ú²Ó
  Dim iI%, iCol%
  Dim lRow&
  Dim sStr$, sPath$, sFlName$
  Dim bMatch As Boolean
  Dim diPro, diTit, vA, vD1, vD2
  Dim wsSou As Worksheet, wsTar As Worksheet
  
  Set wsSou = ThisWorkbook.Sheets("¥X³f")
  Set diPro = CreateObject("Scripting.Dictionary") ' °Ó«~¯Ê¼Æ
  Set diTit = CreateObject("Scripting.Dictionary") ' ¾ÚÂI¦C¼Æ
  
  sPath = ThisWorkbook.Path ' ¦pªG­n«ü©w¥Ø¿ý, ¥u­n§ï¦¨¸Ó¥Ø¿ý§Y¥i, ¦p sPath = "D:"
  sFlName = "³Ì·s®w¦s.xlsx"
  bMatch = False ' Àˬd '³Ì·s®w¦s.xlsx' Àɮ׬O§_¤w¶}±Ò
  For iI = 1 To Workbooks.Count
    If Workbooks(iI).Name = sFlName Then
      bMatch = True
      Exit For
    End If
  Next iI
  If bMatch Then
    Set wsTar = Workbooks(sFlName).Sheets("¼t¯Êªí")
    wsTar.Activate
  Else
    Set wsTar = Workbooks.Open(Filename:=sPath & "\" & sFlName).Sheets("¼t¯Êªí")
  End If
  
  With wsSou ' Ū¨ú¥X³f¸ê®Æ
    iCol = 45 '¼t¯Ê°_©l¦æ
    While .Cells(3, iCol) <> ""
      sStr = .Cells(3, iCol) ' ¾ÚÂI¦W
      lRow = 4 '°Ó«~°_©l¦C
      While .Cells(lRow, 8) <> "" ' °Ó«~¦WºÙ
        If .Cells(lRow, iCol) > 0 Then
          If diPro.Exists(sStr) Then
            diPro(sStr) = diPro(sStr) & "," & lRow & "-" & .Cells(lRow, iCol)
          Else
            diPro(sStr) = lRow & "-" & .Cells(lRow, iCol)
          End If
        End If
        lRow = lRow + 1
      Wend
      iCol = iCol + 1
    Wend
  End With

  With wsTar ' ²£¥Í¼t¯Êªí
    .Range(.[A6], .Cells(Rows.Count, 8)).Delete Shift:=xlShiftUp
    lRow = 3
    For Each vA In diPro
      With .Cells(lRow, 2).Resize(, 6) ' ¾ÚÂI¦W
        With .Cells(1)
          .Value = vA
          diTit(vA) = lRow
          .HorizontalAlignment = xlCenter
          .VerticalAlignment = xlCenter
          With .Font
            .Size = 22
            .Bold = False
          End With
        End With
        
        With .Interior
            .Pattern = xlPatternLinearGradient
            .Gradient.Degree = 90
            .Gradient.ColorStops.Clear
          With .Gradient.ColorStops.Add(0)
            .ThemeColor = xlThemeColorDark1
            .TintAndShade = 0
          End With
          With .Gradient.ColorStops.Add(1)
            .Color = 118671
            .TintAndShade = 0
          End With
        End With
      End With
      lRow = lRow + 1
      
      sStr = diPro(vA)
      vD1 = Split(sStr, ",")
      For iI = 0 To UBound(vD1)
        vD2 = Split(vD1(iI), "-")
        .Cells(lRow, 1) = wsSou.Cells(vD2(0), 6) ' ®Æ¸¹
        .Cells(lRow, 2) = wsSou.Cells(vD2(0), 8) ' °Ó«~¦WºÙ
        .Cells(lRow, 4) = wsSou.Cells(vD2(0), 7) ' ½c¤J¼Æ
        .Cells(lRow, 5) = vD2(1) ' ¤í²~¼Æ
        .Cells(lRow, 6) = Int(vD2(1) / .Cells(lRow, 4)) ' ½c
        .Cells(lRow, 7) = vD2(1) Mod .Cells(lRow, 4) ' ²~
        .Cells(lRow, 8) = wsSou.Cells(vD2(0), 5) ' ½¦±a
        lRow = lRow + 1
      Next
    Next
   
    lRow = lRow - 1
    With .Range(.[B3], .Cells(lRow, 7))
      .Font.Size = 18
      .Borders(xlEdgeLeft).LineStyle = xlContinuous
      .Borders(xlEdgeTop).LineStyle = xlContinuous
      .Borders(xlEdgeBottom).LineStyle = xlContinuous
      .Borders(xlEdgeRight).LineStyle = xlContinuous
      .Borders(xlInsideVertical).LineStyle = xlContinuous
      .Borders(xlInsideHorizontal).LineStyle = xlContinuous
    End With
    For Each vA In diTit
      With .Cells(diTit(vA), 2).Resize(, 6)
        .Borders(xlInsideVertical).LineStyle = xlNone
        .Borders(xlInsideHorizontal).LineStyle = xlNone
      End With
    Next
    With .Range(.[D3], .Cells(lRow, 3))
      .Font.ColorIndex = 23
    End With
  End With
  MsgBox "¯Ê®Æ©ú²Ó¤w²£¥Í§¹²¦..."
End Sub

¦Û°Ê®Mªí-Ans2.zip (56.31 KB)

TOP

        ÀR«ä¦Û¦b : ¤â¤ß¦V¤U¬O§U¤H¡A¤â¤ß¦V¤W¬O¨D¤H¡F§U¤H§Ö¼Ö¡A¨D¤Hµh­W¡C
ªð¦^¦Cªí ¤W¤@¥DÃD