Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: Validation two ranges in one column

  1. #1
    Board Regular
    Join Date
    Mar 2002
    Posts
    220
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi again,
    How do I change the macro below if I need to have two ranges in column B
    like B1:B12 and B20:B30.

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    On Error Resume Next
    If Target.Row < 1 Or Target.Row > 12 Then Exit Sub

    If Target.Column = 2 Then
    If Target.Offset(0, -1) = "" Then
    MsgBox "You cannot enter data in Column B if the cell in Column A is blank"
    Target.Offset(0, -1).Select
    End If
    End If

    End Sub
    Thanks a million
    Andonny


  2. #2
    New Member
    Join Date
    Apr 2002
    Posts
    4
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    On Error Resume Next
    If Not Application.Intersect(Target, [B1:B12, B20:B30]) Is Nothing Then
    If Target.Offset(0, -1) = "" Then
    MsgBox "You cannot enter data in Column B if the cell in Column A is blank"
    Target.Offset(0, -1).Select
    End If
    End If
    End Sub

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •