|
お世話になります。
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
Dim a As Range, b As Range, c As Range, d As Range
Set a = Intersect(Target, Range("A1:H50"))
Set b = Intersect(Target, Range("A51:H100"))
Set c = Intersect(Target, Range("A101:H150"))
Set d = Intersect(Target, Range("A151:H200"))
If Not a Is Nothing Then
Userform1.Label.Caption = "P1"
ElseIf Not b Is Nothing Then
Userform1.Label.Caption = "P2"
ElseIf Not c Is Nothing Then
Userform1.Label.Caption = "P3"
ElseIf Not d Is Nothing Then
Userform1.Label.Caption = "P4"
End If
Set a = Nothing: Set b = Nothing: Set c = Nothing: Set d = Nothing
For〜Nextで、やってみたいのですが、出来ませんでした。
宜しく、お願いします。
|
|