Provided the selected range is no enormous:
Sub tryme()
Set mydata = Selection
myrows = mydata.Rows.Count
mycols = mydata.Columns.Count
For j = 1 To myrows
mycount = 0
For k = 1 To mycols
If mydata(j, k) < "" Then mycount = mycount + 1
Next k
If mycount = 0 Then MsgBox "Empty row " & j
If mycount 1 Then MsgBox "Too much data in row " & j
Next j
End Sub
best wishes
--
Bernard Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
"Subodh" wrote in message
...
I have selected a range with 20 rows and 10 columns.
I want to ensure that every rows in the selectin has
one value in it. Also, it should be ensured that every row has
just one value. ie. no two columns in the same row have data in
it. I tried the following code. I need the suggestions in it.
Thanks in advance.
Sub isrowempty(emptyrow As Boolean)
'to check if the selected row is empty or not
emptyrow = False
For i = 1 To Selection.Rows.Count
If IsEmpty(Selection.Range("A" & i)) Then
If IsEmpty(Selection.Range("B" & i)) Then
If IsEmpty(Selection.Range("C" & i)) Then
Mymsgbox "Selected Range Contains empty Row." _
& vbNewLine & " No Range in the selection
should be empty."
emptyrow = True
Exit Sub
End If
End If
End If
Next
End Sub