Looping Macro Doesn't Work
Help. I can't seem to get this to work.
Sub Macro1() Do While ActiveCell.Row < 7 Range("A" & ActiveCell.Row - 10).Select Selection.ClearContents Loop End Sub What did I do wrong? Thanks Rob |
Looping Macro Doesn't Work
Nevermind I fig'd where I messed up...
Do While ActiveCell.Row < 7 Should have been Do While ActiveCell.Row 7 "Rob" wrote: Help. I can't seem to get this to work. Sub Macro1() Do While ActiveCell.Row < 7 Range("A" & ActiveCell.Row - 10).Select Selection.ClearContents Loop End Sub What did I do wrong? Thanks Rob |
Looping Macro Doesn't Work
Rob,
You cannot select a cell in row 0 or any row less than 1. So the activecell.row MUST be 10 if you want to then select a cell in the Activecell.Row-10 Your code will still produce an error, say if you were coming from row 8. "Rob" wrote: Nevermind I fig'd where I messed up... Do While ActiveCell.Row < 7 Should have been Do While ActiveCell.Row 7 "Rob" wrote: Help. I can't seem to get this to work. Sub Macro1() Do While ActiveCell.Row < 7 Range("A" & ActiveCell.Row - 10).Select Selection.ClearContents Loop End Sub What did I do wrong? Thanks Rob |
Looping Macro Doesn't Work
So I found. I always confuse < . Thanks for the reply.
Rob "cush" wrote: Rob, You cannot select a cell in row 0 or any row less than 1. So the activecell.row MUST be 10 if you want to then select a cell in the Activecell.Row-10 Your code will still produce an error, say if you were coming from row 8. "Rob" wrote: Nevermind I fig'd where I messed up... Do While ActiveCell.Row < 7 Should have been Do While ActiveCell.Row 7 "Rob" wrote: Help. I can't seem to get this to work. Sub Macro1() Do While ActiveCell.Row < 7 Range("A" & ActiveCell.Row - 10).Select Selection.ClearContents Loop End Sub What did I do wrong? Thanks Rob |
All times are GMT +1. The time now is 09:23 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com