- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
|
¦^´_ 1# lancerlot1980
Àɮ׸ê®Æ¶q¨S¦³«Ü¦h¡A¦ý¬O´N¤w¸g2.6MB¤F¡A¬O¤½¦¡¤Ó¦h¤U±ªºµ{¦¡½X¥i´À¥N¤½¦¡.- Private Sub Workbook_Open() 'ThisWorkbookª«¥óªºµ{¦¡½X
- Dim E As Range
- With Sheets("¤U©Ô¿ï³æ").UsedRange.SpecialCells(xlCellTypeConstants)
- For Each E In .Areas
- E.CreateNames Top:=True '©w¸q¦WºÙ ¥X³fª¬ºA ÅU«È¨Ó·½ ¥X³f¤è¦¡ ...
- Next
- End With
- End Sub
½Æ»s¥N½X- '201401 ¤u§@ªíª«¥óªºµ{¦¡½X
- Private Sub Worksheet_Change(ByVal Target As Range)
- Dim Rng As Range
- If Target.Cells(1).Column < 4 Then Exit Sub 'AÄæ-CÄæ
- Application.EnableEvents = False
- With Target.Cells(1)
- Select Case .Row
- Case 6 '¿é¤J ¶l»¼°Ï¸¹
- Set Rng = Sheets("¶l»¼°Ï¸¹").[a:a].Find(Target.Cells(1), lookat:=xlWhole)
- If Not Rng Is Nothing Then
- Target.Cells(1).Offset(1) = Rng.Offset(, 1)
- Else
- Target.Cells(1).Offset(1) = ""
- End If
- Case Is >= 23, 13 '¿é¤J ¼Æ¶q
- Cells(13, .Column) = Application.WorksheetFunction.SumProduct([C23:C2022], [C23:C2022].Offset(, .Column - 3))
- With Cells(17, .Column)
- If Cells(13, .Column) <= Application.Sum([C14:C15].Offset(, .Column - 3)) Then
- .Cells = Cells(16, .Column)
- Else
- .Cells = Cells(13, .Column) - Application.Sum([C14:C15].Offset(, .Column - 3)) + Cells(16, .Column)
- End If
- End With
- Case 14 To 17 '¿é¤J §é¦©A, §é¦©B,¹B¶O
- With Cells(17, .Column)
- If Cells(13, .Column) <= Application.Sum([C14:C15].Offset(, .Column - 3)) Then
- .Cells = Cells(16, .Column)
- Else
- .Cells = Cells(13, .Column) - Application.Sum([C14:C15].Offset(, .Column - 3)) + Cells(16, .Column)
- End If
- End With
- End Select
- End With
- Application.EnableEvents = True
- End Sub
- Private Sub Worksheet_SelectionChange(ByVal Target As Range)
- Dim S As String
- Cells.Validation.Delete '§R°£ ©Ò¦³ªºÀx¦s®æªºÅçÃÒ(¤U©Ô¿ï³æ)
- With Target.Cells(1)
- If .Column >= 4 Then
- Select Case .Row
- Case 2
- S = "=¥X³fª¬ºA"
- Case 9
- S = "=ÅU«È¨Ó·½"
- Case 19
- S = "=¥X³f¤è¦¡"
- End Select
- End If
- If Target.Cells(1).Address = "$C$1" Then S = "=" & Range("D1", [D1].End(xlToRight)).Address '§Ç¸¹ ªº½d³ò
- If S <> "" Then
- With .Validation 'Àx¦s®æªºÅçÃÒ(¤U©Ô¿ï³æ)
- .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:=S '«ü©w¤½¦¡
- End With
- End If
- End With
- End Sub
½Æ»s¥N½X- Option Explicit
- Private Sub Autoform_Click()
- '¶}©l»s§@
- Dim Rng As Range, E As Range
- With Sheets("201401")
- Set Rng = .Range("D1", .[D1].End(xlToRight)).Find(.[C1], lookat:=xlWhole)
- End With
- If Rng Is Nothing Then MsgBox Rng & "§ä¤£¨ì": Exit Sub
- If Application.Sum(Rng.Range("A23:A2022")) <= 0 Then MsgBox Rng & "¨S¦³¿é¤J": Exit Sub
- With Sheets("¥X³f³æ")
- .Range("B3:B6,D3:D6,F3:F6,A8:F" & .Rows.Count) = ""
- .Range("B3:B5") = Rng.Range("A3:A5").Value '½Æ»s°ò¥»¸ê®Æ
- .Range("B6") = Rng.Range("A7") & Rng.Range("A8") '½Æ»s¦a§}
- .Range("D3") = Rng.Range("A10") '½Æ»sq³f¤é´Á
- .Range("D4") = Rng.Range("A18") '½Æ»s¹w´Á¥X³f¤é
- .Range("D5") = Rng.Parent.Range("A2") & Rng '½Æ»s¥X³f§Ç¸¹
- .Range("D6").Value = Rng.Range("A20") '½Æ»sª«¬y½s¸¹
- .Range("F3:F6") = Rng.Range("A14:A17").Value '½Æ»spºâª÷ÃB
- For Each E In Rng.Range("A23:A2022").SpecialCells(xlCellTypeConstants, xlNumbers) '¦³¼Æ¦rªºÀx¦s®æ
- With .Cells(Rows.Count, 1).End(xlUp).Offset(1) '¥X³f³æ AÄæ:¥Ñ³Ì«á¤@¦C©¹¤W¨ì¦³¸ê®ÆÀx¦s®æ.Offset(1)
- .Cells(1, 1) = E.Offset(, -E.Column + 1) '«~¶µ
- .Cells(1, 2) = E.Offset(, -E.Column + 2) '«~¦W
- .Cells(1, 3) = E.Offset(, -E.Column + 3) 'ª÷ÃB
- .Cells(1, 4) = E '¼Æ¶q
- .Cells(1, 5) = .Cells(1, 3) * .Cells(1, 4) '¤pp
- End With
- Next
- .PageSetup.PrintArea = "$A1:$F$" & .Cells(Rows.Count, 1).End(xlUp).Row '³]©w¦L¦C½d³ò¦Lªí
- .PrintOut '¦Lªí
- End With
- End Sub
½Æ»s¥N½X |
|