Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() As ALWAYS, post your code for comments if activecell.row=1 then exit sub -- Don Guillett Microsoft MVP Excel SalesAid Software "Joek" wrote in message ... 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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 "Don Guillett" wrote: As ALWAYS, post your code for comments if activecell.row=1 then exit sub -- Don Guillett Microsoft MVP Excel SalesAid Software "Joek" wrote in message ... 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 . |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How about something like this
If Selection.Row = 1 And _ Selection.Rows.Count = 1 Then Exit Sub -- HTH, Barb Reinhardt "Joek" wrote: 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 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for the prompt reply Barb
your solution was most helpful Joe "Barb Reinhardt" wrote: How about something like this If Selection.Row = 1 And _ Selection.Rows.Count = 1 Then Exit Sub -- HTH, Barb Reinhardt "Joek" wrote: 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 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
with activesheet
If intersect(selection, .rows(1)) is nothing then 'do the work else msgbox "don't touch row 1!" end if end with Joek wrote: 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 -- Dave Peterson |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Dave
As with all these solutions - very simple and straightforward. Thanks Joe "Dave Peterson" wrote: with activesheet If intersect(selection, .rows(1)) is nothing then 'do the work else msgbox "don't touch row 1!" end if end with Joek wrote: 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 -- Dave Peterson . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to select files and then run different macro on selected file | Excel Programming | |||
Run macro when cell is selected | Excel Programming | |||
run macro when cell is selected | Excel Worksheet Functions | |||
Macro to take selected cells times a selected cell | Excel Programming | |||
Macro to run in same row as selected button | Excel Programming |