I am working on an Excel sheet of row size A:ZZ and there should only be 7 cells with values. I am trying to make a kind of "filter" that will check the number of non empty cells and in case when there will be more than 7 nonempty cells will print a message in MsgBox (and till this point is working). But in the MsgBox I would like to se also just those values from the row (separated eg. with coma) - this is although not working due to some problem with Intersect syntax. Here is the code
Sub blanks()
Dim a, b As Integer
a = 0
Range("A1").Select
Do
With ActiveSheet.Range(Rows(b))
b = ActiveCell.Row
a = Application.WorksheetFunction.CountA(ActiveSheet.Rows(b))
If a > 7 Then
MsgBox ("ERROR" & "/n" & Application.Intersect(.SpecialCells(xlCellTypeVisible)))
Exit Do
Else
ActiveCell.Offset(1, 0).Select
End If
End With
Loop Until ActiveCell = "stop"
End Sub
What is there wrong?