![]() |
clear contents
hi! I have a named range consiting of only one cell. i want to clear the
contents of e cells starting at the named range until there are empty cells. Example: my named range is a1. I want to clear a2,a3,a4 etc until i find a cell that is empty. also i want to do the same with a2,b2,c2 until i find an empty cell. also i want the field between the last cells eg a3 and c2 to be cleared also (regardless of the contents). how can i do this? pls help! |
clear contents
Try something like this
Sub ClearUntilEmpty() Dim myRange As Range Set myRange = Range("A4") Do While Not IsEmpty(myRange) myRange.ClearContents Set myRange = myRange.Offset(0, 1) Loop End Sub "Arne Hegefors" wrote: hi! I have a named range consiting of only one cell. i want to clear the contents of e cells starting at the named range until there are empty cells. Example: my named range is a1. I want to clear a2,a3,a4 etc until i find a cell that is empty. also i want to do the same with a2,b2,c2 until i find an empty cell. also i want the field between the last cells eg a3 and c2 to be cleared also (regardless of the contents). how can i do this? pls help! |
All times are GMT +1. The time now is 02:33 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com