I am new to Excel coding and was trying to figure a way to fill in cells.

Using Excel 2007

Example: I have 2 ranges set.

**Range 1 **= cells B2, C2 and D2

**Range 2** = cells D6, E6 and F6

All cells are blank.

If I enter anything in either of the cells in **Range 1** then all the cells in **Range 2** are filled in and as long as anything stays in** Range 1** nothing can be entered in **Range 2.**

I then need an error message to pop up stating that you can only enter information for one range.

I tried this as a start to fill in if not blank and that is why I am asking for help.

Private Sub Worksheet_Blank(ByVal Target As Range)

Dim r As Range

If Target.Address <> "**$B$2:$D$2**" Then Exit Sub

Set r = Range("**D6:F6**")

If Target <> " " Then

With r

.Interior.ColorIndex = 3

End With

End If

End Sub

Private Sub Worksheet_SelectionChange(

Dim r As Range

If Not Intersect(Target, Range("B2:D2")) Is Nothing Then

Set r = Range("D6:F6")

If Target <> " " Then

With r

.Interior.ColorIndex = 3

End With

End If

End If

End Sub

Put this in your sheet code module,

Dave