Krijg geen range enkel een enkele cell "L7"

Status
Niet open voor verdere reacties.

mause01

Gebruiker
Lid geworden
19 okt 2012
Berichten
75
Beste Forum leden,

Ik krijg een stukje code niet goed.
Ik wil graag Niet alleen L7 maar
Code:
If Range("L7:L5000").Value Then

wat doe ik fout.

Dim rng As Range

Code:
Set rng = Range("M7:M5000")
    If Not Application.Intersect(Target, rng) Is Nothing Then
        For Each aCell In rng
            If Range[COLOR="#B22222"]("L7")[/COLOR].Value Then
                MsgBox "If the locker is Free-Assignment (“IsFreeAssignment”=1), This field does not apply." & vbNewLine & "The content in field Free-Assignment will be deleted now.", vbExclamation, "Invalid Value"
                Range("L7:L5000").ClearContents
            If aCell.Value <> "" Then
                Select Case aCell.Value
                Case 1, 0
                Case Else
                    aCell.ClearContents
                    MsgBox "You have entered an Invalid Value in this cell. Only 1 or 0 are valid.", vbExclamation, "Invalid Value"
                End Select
            End If
          End If
        Next
    End If
 
Vervang
PHP:
            If aCell.Offset(0, 1).Value Then
eens door
PHP:
            If Range("L7").Value Then
 
In VBA:

Code:
For Each it in Application.Intersect(Target, Range("M7:M5000")) 
  c00=""
  If it.offset(,1) Then
     c00="If the locker is Free-Assignment (“IsFreeAssignment”=1), This field does not apply." & vbLf & "The content in field Free-Assignment will be deleted now."
     if.offset(1).ClearContents
  elseif it<>0 and it <>1 then
     it.ClearContents
     c00= "You have entered an Invalid Value in this cell. Only 1 or 0 are valid."
  End If
  if c00<>"" then msgbox c00
Next
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan