- ©«¤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
|
¥»©«³Ì«á¥Ñ GBKEE ©ó 2014-2-7 17:39 ½s¿è
¦^´_ 4# j88141
¸Õ¸Õ¬Ý- Option Explicit
- Private Sub Workbook_Open() 'ThisWorkbook ¼Ò²Õªºµ{¦¡½X,¶}Àɮɦ۰ʰõ¦æ
- Dim xWeek, xM, Rng(0 To 2) As Range, i As Integer, ii As Integer
- For Each xM In ActiveWorkbook.Names
- xM.Delete
- Next
- xWeek = Split("¬P´Á¤@,¬P´Á¤G,¬P´Á¤T,¬P´Á¥|,¬P´Á¤", ",")
- xM = Split("¦¤W,¤U¤È,±ß¤W", ",")
-
- With Sheets("½ÒªíÂú§Î")
- Set Rng(0) = .Range("D3:D18") '¦¤W®É¬q '¦p¦³¤£¹ï½Ð¦Û¦æקï
- Set Rng(1) = .Range("D19:D34") '¤U¤È®É¬q
- Set Rng(2) = .Range("D35:D42") '±ß¤W®É¬q
- For i = 0 To 4
- For ii = 0 To 2
- Rng(ii).Offset(, i).Name = xWeek(i) & xM(ii)
- Next
- Next
- End With
- End Sub
½Æ»s¥N½X "½ÒªíÂú§Î" ¤u§@ªí¼Ò²Õªºµ{¦¡½X- Option Explicit Private
- Sub Worksheet_Change(ByVal Target As Range)
- Application.EnableEvents = False
- If ®É¬q(Target) Then Target = ""
- Application.EnableEvents = True
- End Sub
- Private Function ®É¬q(xRng As Range) As Boolean '¶Ç¦^ False ¦¨¬° 0 ¡A¦Ó True ¦¨¬° -1
- Dim xR As String, N As Name, C As CheckBox
- For Each N In ActiveWorkbook.Names
- If Not Application.Intersect(Range(N), xRng) Is Nothing Then
- xR = N.Name '¨ú±o ¬P´Á¤W¤U±ßªº®É¬q
- Exit For
- End If
- Next
- With Sheets("¦Ñ®v¤£±Æ½Ò®É¬q")
- For Each C In .CheckBoxes
- If .Cells(C.TopLeftCell.Row, 1) = xRng And C = 1 Then
- If xR = .Cells(1, C.TopLeftCell.Column).MergeArea.Cells(1) & C.TopLeftCell.End(xlUp) Then
- '¬P´Áªº®É¬q .Cells(1, C.TopLeftCell.Column).MergeArea.Cells(1)
- '¤W¤U±ßªº®É¬q C.TopLeftCell.End(xlUp)
- ®É¬q = True
- MsgBox xRng & vbLf & xR & vbLf & "¤£±Æ½Òµ{"
- Exit For
- End If
- End If
- Next
- End With
- End Function
½Æ»s¥N½X |
|