Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Macro to clear contents and put an X
I can get a macro to work on one row but I want to be able to use on any row.
Here is what i have so far: Range("E19:N19").Select Selection.ClearContents Range("P19").Select ActiveCell.FormulaR1C1 = "X" Range("P20").Select I want to be able to be on any row, whether it be Row 19 or Row 700 and be able to run this. The column will stay the same. |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Macro to clear contents and put an X
This will clear contents of columns E:N of whatever row you are currently on,
and put a "X" in the P column. Not sure if you really needed the cell below the "X" selected or not, but I included it anyway. Range("E" & ActiveCell.Row & ":N" & ActiveCell.Row).ClearContents Range("P" & ActiveCell.Row).Value = "X" Range("P" & ActiveCell.Row+1).Select If you're detemrining the row via the macro, simply replace 'ActiveCell.Row' with a number/variable. -- Best Regards, Luke M *Remember to click "yes" if this post helped you!* "bevchapman" wrote: I can get a macro to work on one row but I want to be able to use on any row. Here is what i have so far: Range("E19:N19").Select Selection.ClearContents Range("P19").Select ActiveCell.FormulaR1C1 = "X" Range("P20").Select I want to be able to be on any row, whether it be Row 19 or Row 700 and be able to run this. The column will stay the same. |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Macro to clear contents and put an X
Sub relativee()
n = ActiveCell.Row Range("E" & n & ":N" & n).ClearContents Range("P" & n).Value = "X" Range("P" & n + 1).Select End Sub -- Gary''s Student - gsnu200839 |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Macro to clear contents and put an X
Thank you! Works perfect!
"Luke M" wrote: This will clear contents of columns E:N of whatever row you are currently on, and put a "X" in the P column. Not sure if you really needed the cell below the "X" selected or not, but I included it anyway. Range("E" & ActiveCell.Row & ":N" & ActiveCell.Row).ClearContents Range("P" & ActiveCell.Row).Value = "X" Range("P" & ActiveCell.Row+1).Select If you're detemrining the row via the macro, simply replace 'ActiveCell.Row' with a number/variable. -- Best Regards, Luke M *Remember to click "yes" if this post helped you!* "bevchapman" wrote: I can get a macro to work on one row but I want to be able to use on any row. Here is what i have so far: Range("E19:N19").Select Selection.ClearContents Range("P19").Select ActiveCell.FormulaR1C1 = "X" Range("P20").Select I want to be able to be on any row, whether it be Row 19 or Row 700 and be able to run this. The column will stay the same. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Clear Contents | Excel Discussion (Misc queries) | |||
Macro to clear contents of unprotected cells AND drop down boxes | Excel Discussion (Misc queries) | |||
HOW DO I PROTECT VALUES WHEN CREATING CLEAR CONTENTS MACRO? | Excel Discussion (Misc queries) | |||
Clear Contents Macro | Excel Worksheet Functions | |||
Clear Contents But Not Formula | Excel Discussion (Misc queries) |