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

[µo°Ý] «ö¦W³æ¤Îªí®æ½d¥»·s¼W¤u§@ªí

[µo°Ý] «ö¦W³æ¤Îªí®æ½d¥»·s¼W¤u§@ªí

¦Ñ®v¦n,¦³¤u§@ªí¬O"¦W³æ", ¥t¦³¤u§@ªí"ªí®æ½d¥»", ½Ð°Ý¦p¦ó¥ÎVBA¼g¥X, «ö"¦W³æ"·s¥[¤u§@ªí, ¤u§@ªí¦WºÙ¬O"¦W³æ"²Ä1¦æ, ¦Ó¤u§@ªí¤º®e¬O"ªí®æ½d¥»"??

¦³³Ò½ç±Ð «ö¦W³æ¤Îªí®æ½d¥»·s¼W¤u§@ªí.zip (18.14 KB)

¤è®×¤@¡G½Æ»s¤u§@ªí©Î§ó·s¤º®e¡]¦pªG¤H­û¤u§@ªí¤w¦s¦b¡^
  1. Sub §ó·s()
  2. Dim xR As Range, MySht As Worksheet, Sht As Worksheet, AR, i%
  3. Set MySht = ActiveSheet
  4. MySht.AutoFilterMode = False
  5. Application.ScreenUpdating = False
  6. For Each xR In Range(MySht.[A2], MySht.[A65536].End(xlUp))
  7.     If xR.Row = 1 Then Exit Sub
  8.     On Error Resume Next
  9.     Set Sht = Nothing:  Set Sht = Sheets(xR.Value)
  10.     On Error GoTo 0
  11.     If Sht Is Nothing Then
  12.        Sheets("ªí®æ½d¥»").Copy After:=Sheets(Sheets.Count)
  13.        Set Sht = ActiveSheet:  Sht.Name = xR.Value
  14.        MySht.Select
  15.     End If
  16.     AR = Array("B3", "B4", "E3", "E4", "B6", "B7")
  17.     For i = 0 To UBound(AR)
  18.         Sht.Range(AR(i)) = ""
  19.         If xR(1, i + 1) <> "" Then Sht.Range(AR(i)) = xR(1, i + 1).Text
  20.     Next i
  21. Next
  22. End Sub
½Æ»s¥N½X
¤è®×¤G¡G¥H¤@±iªí¦@¥Î
  1. Sub ¥Ó½Ðªí()
  2. Dim xR As Range, AR
  3. Set xR = ActiveCell
  4. If xR.Row = 1 Or xR.Column > 1 Or xR.Value = "" Then
  5.     MsgBox "½Ð¦b¢ÏÄæ¿ï¾Ü­n¶ñ¤J¥Ó½Ðªíªº¤H­û©m¦W¡I¡@": Exit Sub
  6. End If
  7. AR = Array("B3", "B4", "E3", "E4", "B6", "B7")
  8. With Sheets("¥Ó½Ðªí")
  9.      For i = 0 To UBound(AR)
  10.          .Range(AR(i)) = ""
  11.          If xR(1, i + 1) <> "" Then .Range(AR(i)).Value = xR(1, i + 1).Text
  12.      Next i
  13.      .Select
  14. End With
  15. End Sub
½Æ»s¥N½X
¡@
Xl0000027.rar (13.97 KB)
¡@
¡@

TOP

¦hÁ«ü¾É. §Ú¦Û¤v«ä¦Ò¤F¤@­Ó¤èªk·s¼W¤u§@ªí.  ¦ý·Q¥ÎFILTER, ¥ÎINPUT BOX°Ý­n·s¼W¨º¤@­Ó³¡ªùªº¤u§@ªí, ¦p¿é¤JACC, «h¥u·s¼WACCªº¤u§@ªí. ³oÀ³¦p¦ó°µ??? VBA ¥Ó½ÐªíV5.zip (20.32 KB)
  1. Sub copytosheetok2()

  2. Dim MyCell As Range, MyRange As Range

  3. Set MyRange = Sheets("list").Range("A2")
  4. Set MyRange = Range(MyRange, MyRange.End(xlDown))

  5.     Application.ScreenUpdating = False
  6.     Application.DisplayAlerts = False

  7. For Each MyCell In MyRange
  8.    
  9.    
  10. Sheets("form").Copy After:=Sheets(Sheets.Count) 'Create a new worksheet

  11. Sheets(Sheets.Count).Name = MyCell.Value 'Renames the new worksheets

  12. For i = 3 To Sheets.Count
  13.         With Sheets(i).Range("A1:E7")
  14.                  .Value = .Value
  15.         End With
  16.    
  17.           With Sheets(i).Range("A10:B11")
  18.                  .Value = .Value
  19.         End With
  20.     Next i

  21. Next MyCell
  22.    Application.ScreenUpdating = True
  23.     Application.DisplayAlerts = True


  24. End Sub
½Æ»s¥N½X
¦^´_ 2# ­ã´£³¡ªL

TOP

¦^´_ 3# missbb

¥i¦p¦ó¥[¤J¤U¦CCODE, FILTER«á¤~·s¼W¤u§@ªí:
Input box : ¿é¤J³¡ªù
¨Ò¦p:ACC ©Î¥þ³¡
sheets("list").Select
ActiveSheet.Range("$A$1:$Z$1048576").AutoFilter Field:=2, Criteria1:="ACC"
¥u·s¼W³¡ªù¬OACCªº¤u§@ªí
.......¤£À´¦p¦ó±µ¤U¥h.....

TOP

¥»©«³Ì«á¥Ñ Kubi ©ó 2016-11-8 09:34 ½s¿è

¦^´_ 4# missbb
§ï¥Î·Æ¹«ÂI¿ïBÄæ¬Y­Ó³¡ªù«á¡A¦A«ö°õ¦æ¶s¨Ó·s¼W¸Ó³¡ªùªº¤u§@ªí¡A¤Ï¤§¡A«h·s¼W¥þ³¡ªù¤u§@ªí¡C
VBA ¥Ó½ÐªíV5.rar (23.9 KB)

TOP

¦^´_ 5# Kubi

¦ý¤@«öHRA¥u¦L¥X¤@¥÷HRA, ¥i§_«öHRA, ©Ò¦³HRA·|¦L¥X?

TOP

¦^´_ 6# missbb
©³¤Uªºµ{¦¡½X¥u¦L¥X§A©Ò¿ïªº¬Y³¡ªù¤º©Ò¦³¤H­û¸ê®Æ¡A³o·|»P¤W­±¼Ó¼h(­z¨D¡G·s¼W¤u§@ªí)ªº§@·~§¹¥þ¤£¦P¡C
ÁÙ¦³¡A­Y­n¦L¥X©Ò¦³³¡ªù¸ê®Æ¡A«h½Ð¦Û¦æ½m²ß­×§ïµ{¦¡½X¡C
VBA ¥Ó½ÐªíV5-Print.rar (24.17 KB)

TOP

¦^´_ 7# Kubi

¦³³Ò赐±Ð

TOP

¥H¤W¦U¦ì«ä¸ô³£«D±`¦n¡A关键¬O写VBA¥N码ªº时­Ô¦Ò虑简¤Æ©M¥N码³Ìɬ¤Æ¡A·P谢¤À¨É¦U¦ì¤À¨É经验¤Î§Þ术¥N码¡C

TOP

¦^´_ 7# Kubi

§A¦n, §Ú¤S¸Õ¤F¿z¿ïLISTªº³¡ªù¬OHRA, ¦ACOPY ¥u¦³³¡ªù¬OHRAªº¤u§@ªí, ¦ý¤S¬O¥þ³¡³£COPY¥X¤u§@ªí(HRA, ACC) VBA ¥Ó½ÐªíV1 original (2).zip (22.91 KB) , ½Ð°Ý¤U¦CCODE¦³¬Æ»ò¤í¯Ê?
Sub copytosheetok3()


Dim Rng As Range        
Dim theRow As Range     
Dim theArea As Range      
    With Sheets("list")      
        Set Rng = .UsedRange   
        Rng.AutoFilter Field:=2, Criteria1:="HRA"     '¿z¿ï
            Set Rng = Rng.Resize(Rng.Rows.Count - 1).Offset(1, 0).SpecialCells(xlCellTypeVisible)
    End With

Dim MyCell As Range, MyRange As Range
Set MyRange = Sheets("list").Range("A2")
Set MyRange = Range(MyRange, MyRange.End(xlDown))

    Application.ScreenUpdating = False
    Application.DisplayAlerts = False

For Each MyCell In MyRange
        
Sheets("form").Copy after:=Sheets(Sheets.Count) 'Create a new worksheet

Sheets(Sheets.Count).Name = MyCell.Value 'Renames the new worksheets

For i = 3 To Sheets.Count
        With Sheets(i).Range("A1:E7")
                 .Value = .Value
        End With
   
          With Sheets(i).Range("A10:B11")
                 .Value = .Value
        End With
    Next i

Next MyCell
   Application.ScreenUpdating = True
    Application.DisplayAlerts = True


End Sub

TOP

        ÀR«ä¦Û¦b : ¤@­Ó¯Ê¤fªºªM¤l¡A¦pªG´«¤@­Ó¨¤«×¬Ý¥¦¡A¥¦¤´µM¬O¶êªº¡C
ªð¦^¦Cªí ¤W¤@¥DÃD