![]() |
![]() |
|
|||||||
| 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,
Derek was so kind and wrote me the macro below and it is just what I need. Sometimes I would like to actually have a range from B5:B10 validated. How do I change to macro to achieve this. Private Sub Worksheet_SelectionChange(ByVal Target As Range) On Error Resume Next 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 By the way I love the new forum setup with php. Thank you once again Andonny |
|
|
|
|
|
#2 | |
|
MrExcel MVP
Join Date: Mar 2002
Location: Chicago, IL USA
Posts: 2,042
|
Quote:
If Target.Row < 5 or Target.Row > 10 Then Exit Sub after the On Error Resume Next statement and you will bound the event region. HTH, Jay |
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|