Hello,
The code provided works great but I'm tring to insert it into this
code2 but it is not working right. It does not go to the next cell it
stays at row 8 and does not go to row 9 and so on. How can this code1
be inserted into code2 to work right?
code1
Dim c As Variant
For c = 8 To 15
If Cells(c, "B").Value & Cells(c, "D").Value & Cells(c,
"E").Value _
= "" Then Exit Sub
Next c
code2
Sub ErrorCheckData()
'Tom Ogilvy
Dim i As Long
Dim Cell As Range, cell1 As Range
Dim Rng As Range
Dim msg(1 To 3) As String
msg(1) = "ERROR Date is empty"
msg(2) = "ERROR Description is empty"
msg(3) = "ERROR Type is empty"
For Each Cell In Range("B8:B15")
Set Rng = Cell.Range("A1,C1:D1")
i = 1
For Each cell1 In Rng
If cell1 = "" Then
cell1.Interior.ColorIndex = 15
MsgBox msg(i) & ": " & Cell.Address
End
End If
i = i + 1
Next cell1
Next Cell
End Sub
The code I tried and did not work right:
Sub ErrorCheckData()
'Tom Ogilvy
Dim i As Long
Dim c As Variant
Dim Cell As Range, cell1 As Range
Dim Rng As Range
Dim msg(1 To 3) As String
msg(1) = "ERROR Date is empty"
msg(2) = "ERROR Description is empty"
msg(3) = "ERROR Type is empty"
For Each Cell In Range("B8:B15")
Set Rng = Cell.Range("A1,C1:D1")
i = 1
For c = 8 To 15
If Cells(c, "B").Value & Cells(c, "D").Value & Cells(c,
"E").Value _
= "" Then Exit Sub
For Each cell1 In Rng
If cell1 = "" Then
cell1.Interior.ColorIndex = 15
MsgBox msg(i) & ": " & Cell.Address
End
End If
i = i + 1
Next cell1
Next c
Next Cell
End Sub
Thank you for your help,
jfcby
Dave Peterson wrote:
<vbg
Don Guillett wrote:
Maybe " I " should test.
--
Don Guillett
SalesAid Software
"Dave Peterson" wrote in message
...
I think Gary's Student was actually concatenating all those cells into a
single
string and then comparing that concatenated string to "".
If the OP wanted to use AND, then it would look more like:
if cells(i,"D").value = "" _
and cells(i,"E").value = "" _
and cells(i, "B").value = "" then
....
Don Guillett wrote:
Fully tested ?
For i = 8 To 15
If Cells(i, "D").Value & Cells(i, "E").Value & Cells(i, "B").Value =
""
If Cells(i, "D").Value AND Cells(i, "E").Value AND & Cells(i,
"B").Value = ""
--
Don Guillett
SalesAid Software
"Gary''s Student" wrote in
message
...
sub demo()
For i = 8 To 15
If Cells(i, "D").Value & Cells(i, "E").Value & Cells(i, "B").Value =
""
Then
Exit Sub
End If
Next
End Sub
--
Gary's Student
"jfcby" wrote:
Hello,
My BEGIN row range is "B8,D8:E8" END row range is "B15,D15:E15". I
need
to check each row value and if the row is all blank I want to exit
sub,
if the row range has all data then I want go to continue macro, if a
row has a blank cell I want to continue macro.
This is a example code I've got so far but I do not know how to get it
to loop the the rows:
If Range("B8").Value & Range("D8").Value & Range("E8").Value = "" Then
Exit Sub
Thank you for your help in advance,
jfcby
--
Dave Peterson
--
Dave Peterson