P
Peter Rooney
Good morning all!
The reason for the apology to Norman is I started a different thread
yesterday where he was helping me, but I can't find it at work this morning,
so I hope he doesn't think I'm being rude!
I'm working with a database that occupies columns B:L and I'm trying to
prevent users from having a row where Bx:Lx contains all blank cells, as I
use currentregion to add and delete rows, and it doesn;t work properly if it
encounters a blank row.
This is what I tried in my Worksheet_Change macro (which works in all other
respects). I'm attempting a multiple IF statement to check each cell in the
current row from column B to column L. If all cells are empty, a value is
entered into column F of the current row.
The problem is that although no error messages are displayed re: syntax, the
code just doesn't work when I empty all the cells between column B and column
L in the current row. I've tried this in lots of flavours, including IF
len("B" & .row) = 0, but nothing seems to work. I guess it's something do do
with the way in which I'm trying to concatenate the column letter and the
..row of the Target, but I'm now completely stumped.
Can any of you good people out there on a Monday morning give me a hand?
Thanks in advance (and to you too, Norman for helping a sad old man with
nothing better to do on a Sunday afternoon!)
Pete
With Target
'---------------------------------------------------------------------------------
If .Column >= 2 Then
If .Column <= 12 Then
If Application.isblank("B" & .Row) Then
If Application.isblank("C" & .Row) Then
If Application.isblank("D" & .Row) Then
If Application.isblank("E" & .Row) Then
If Application.isblank("F" & .Row) Then
If Application.isblank("G" & .Row) Then
If Application.isblank("H" & .Row) Then
If Application.isblank("I" & .Row) Then
If Application.isblank("J" & .Row) Then
If Application.isblank("K" & .Row) Then
If Application.isblank("L" & .Row) Then
MsgBox ("You CAN'T have blank rows in the
database!")
Range("F" & Target.Row).Formula = "Blank
Eliminator"
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
The reason for the apology to Norman is I started a different thread
yesterday where he was helping me, but I can't find it at work this morning,
so I hope he doesn't think I'm being rude!
I'm working with a database that occupies columns B:L and I'm trying to
prevent users from having a row where Bx:Lx contains all blank cells, as I
use currentregion to add and delete rows, and it doesn;t work properly if it
encounters a blank row.
This is what I tried in my Worksheet_Change macro (which works in all other
respects). I'm attempting a multiple IF statement to check each cell in the
current row from column B to column L. If all cells are empty, a value is
entered into column F of the current row.
The problem is that although no error messages are displayed re: syntax, the
code just doesn't work when I empty all the cells between column B and column
L in the current row. I've tried this in lots of flavours, including IF
len("B" & .row) = 0, but nothing seems to work. I guess it's something do do
with the way in which I'm trying to concatenate the column letter and the
..row of the Target, but I'm now completely stumped.
Can any of you good people out there on a Monday morning give me a hand?
Thanks in advance (and to you too, Norman for helping a sad old man with
nothing better to do on a Sunday afternoon!)
Pete
With Target
'---------------------------------------------------------------------------------
If .Column >= 2 Then
If .Column <= 12 Then
If Application.isblank("B" & .Row) Then
If Application.isblank("C" & .Row) Then
If Application.isblank("D" & .Row) Then
If Application.isblank("E" & .Row) Then
If Application.isblank("F" & .Row) Then
If Application.isblank("G" & .Row) Then
If Application.isblank("H" & .Row) Then
If Application.isblank("I" & .Row) Then
If Application.isblank("J" & .Row) Then
If Application.isblank("K" & .Row) Then
If Application.isblank("L" & .Row) Then
MsgBox ("You CAN'T have blank rows in the
database!")
Range("F" & Target.Row).Formula = "Blank
Eliminator"
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If