کد:
Sub ExcelIran()
ActiveSheet.Unprotect "123"
Dim cel As Range
Dim TableNum As Integer
i = ActiveCell.Row
If i <= 21 And i >= 19 Then
TableNum = Range("A" & i).Value
For Each cel In Range("B" & i & ":N" & i)
cleared = clearcontent(cel.Value, TableNum)
Next cel
End If
ActiveSheet.Protect "123"
End Sub
Function clearcontent(cel, TableNum As Integer)
Dim C As Range
Select Case TableNum
Case 1
For Each C In Range("c6,d9,f7,f10,f3,g4,g7")
If C.Value = cel Then
C.ClearContents
Exit For
End If
Next C
Case 2
For Each C In Range("k5,l12,n8,o10,p6")
If C.Value = cel Then
C.ClearContents
Exit For
End If
Next C
Case 3
For Each C In Range("r8,s8,t3,t10,v7,w10,x10")
If C.Value = cel Then
C.ClearContents
Exit For
End If
Next C
End Select
End Function
علاقه مندی ها (Bookmarks)