![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Mar 2002
Posts: 217
|
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 |
|
New Member
Join Date: Apr 2002
Posts: 4
|
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 |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|