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

[µo°Ý] ½Ð°Ý½s±Æ¶Ô°È¯Zªí°ÝÃD

¤p§Ìªì¸ÕVBA¡A½Ð±z«ü±Ð
Sub s1()
    Worksheets("¶Ô°Èªí").Select
    For j = 0 To 23
            Cells(9 + j, 19) = "01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,"
        For i = 0 To 11
              '§R°£½ü¥ð
              If Cells(34, 4 + i) <> "" Then
                  Cells(9 + j, 19) = Replace(Cells(9 + j, 19), Cells(34, 4 + i), "")
              End If
            
              '§R°£¥~±J
              If Cells(35, 4 + i) <> "" Then
                  Cells(9 + j, 19) = Replace(Cells(9 + j, 19), Cells(35, 4 + i), "")
              End If
            
              '§R°£®t°²
              If Cells(34, 19 + i) <> "" Then
                  Cells(9 + j, 19) = Replace(Cells(9 + j, 19), Cells(34, 19 + i), "")
              End If
              
              '§R°£¥ð°²
              If Cells(35, 19 + i) <> "" Then
                  Cells(9 + j, 19) = Replace(Cells(9 + j, 19), Cells(35, 19 + i), "")
              End If
        Next i
        
        '§R°£¤w¬£
        For i = 0 To 13
              If Cells(9 + j, 5 + i) <> "" Then
                  Cells(9 + j, 19) = Replace(Cells(9 + j, 19), Cells(9 + j, 5 + i), "")
              End If
        Next i
        For i = 0 To 1
             If Cells(9 + j, 29 + i) <> "" Then
                  Cells(9 + j, 19) = Replace(Cells(9 + j, 19), Cells(9 + j, 29 + i), "")
              End If
        Next i


    Next j
End Sub

TOP

¦^´_ 1# °¨¯Ç
²Ä¤Gª©VBAµ{¦¡½X©ñ¦bWorksheet_SelectionChange¤¤¡A¥u­n¸Ó®É¬q¦³½ü¥ð¡B¥~±J.....¡A¦b³]¶Ô°È®É¥i¥Î¤U©Ô¦¡²M³æ

TOP

¦^´_ 1# °¨¯Ç
§Ú§¹¦¨ªº²Ä¤Gª©¡Aµ{¦¡½X¦p¤U¡A½Ð«ü±Ð¡I

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    For j = 0 To 23
            Cells(9 + j, 19) = "01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,"
        For i = 0 To 11
              '§R°£½ü¥ð
              If Cells(34, 4 + i) <> "" Then
                  Cells(9 + j, 19) = Replace(Cells(9 + j, 19), Cells(34, 4 + i) & ",", "")
              End If
            
              '§R°£¥~±J
              If Cells(35, 4 + i) <> "" Then
                  Cells(9 + j, 19) = Replace(Cells(9 + j, 19), Cells(35, 4 + i) & ",", "")
              End If
            
              '§R°£®t°²
              If Cells(34, 19 + i) <> "" Then
                  Cells(9 + j, 19) = Replace(Cells(9 + j, 19), Cells(34, 19 + i) & ",", "")
              End If
              
              '§R°£¥ð°²
              If Cells(35, 19 + i) <> "" Then
                  Cells(9 + j, 19) = Replace(Cells(9 + j, 19), Cells(35, 19 + i) & ",", "")
              End If
        Next i
        
        '§R°£¤w¬£
        For i = 0 To 13
              If Cells(9 + j, 5 + i) <> "" Then
                  Cells(9 + j, 19) = Replace(Cells(9 + j, 19), Cells(9 + j, 5 + i) & ",", "")
              End If
        Next i
        For i = 0 To 1
             If Cells(9 + j, 29 + i) <> "" Then
                  Cells(9 + j, 19) = Replace(Cells(9 + j, 19), Cells(9 + j, 29 + i) & ",", "")
              End If
        Next i
        
        
        '³]©w¾°È¬£¥ô²M³æ
        With Range(Cells(9 + j, 4), Cells(9 + j, 15)).Validation
            .Delete
            .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:=Cells(9 + j, 19)
        End With
        With Range(Cells(9 + j, 29), Cells(9 + j, 30)).Validation
            .Delete
            .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:=Cells(9 + j, 19)
        End With
    Next j
End Sub

TOP

        ÀR«ä¦Û¦b : ¶¢¤HµL¼Ö½ì¡A¦£¤HµL¬O«D¡C
ªð¦^¦Cªí ¤W¤@¥DÃD