Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro looping? | Excel Worksheet Functions | |||
Looping Macro | Excel Discussion (Misc queries) | |||
Looping macro | Excel Worksheet Functions | |||
Looping macro | Excel Programming | |||
Need help with my looping macro | Excel Programming |