View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
carrera carrera is offline
external usenet poster
 
Posts: 52
Default How to end IF THEN

Thanks Bob! Perfect.

Curious, why does it state columns when you are working with rows?

"Bob Phillips" wrote:

Try this

If Selection.columns.count < Columns.Count Then
MsgBox "MUST SELECT ENTIRE ROW"
Exit Sub
End If


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"carrera" wrote in message
...
I have 2 macros, partially copied below, which are not working out.
What they are supposed to do is....if an entire row is not selcted, you
get
the message box, but if one does select the entire row, there would be no
message box, and the selected entire row would be cut, and the procedure
would continue.

What is happening is that the message box comes up fine when only a cell
is
selected, but I still get the message box when the entire row is selected,
and the macro doesn't proceed.

What am I leaving out? It's like I can't turn the IF THEN "off". I'm sure
it's something very simple.



If TypeName(Selection) < "entirerow" Then
MsgBox "MUST SELECT ENTIRE ROW"
Exit Sub
End If
Selection.Cut .....etc.....

or.....

If ActiveCell.Select < EntireRow Then
MsgBox "MUST SELECT ENTIRE ROW"
Exit Sub
End If

ActiveCell.Select = EntireRow
EntireRow.Cut..........etc.