Not to run macro if row 1 selected

J

Joek

I need to run a macro to delete a row if any cell in that row is selected.
However I do not want the macro to run if row 1 is selected.

Seems simple but I can't get my head around it using IF THEN.

I would be grateful for any help
 
B

Barb Reinhardt

How about something like this

If Selection.Row = 1 And _
Selection.Rows.Count = 1 Then Exit Sub
 
D

Dave Peterson

with activesheet
If intersect(selection, .rows(1)) is nothing then
'do the work
else
msgbox "don't touch row 1!"
end if
end with
 
J

Joek

Thanks Don - a very simple solution.

I was working at something similar but the macro always hung at this point.

Thank you very much

Joe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top