clear contents

G

Guest

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!
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top