?
Solved

Clear a dynamic Range except first line - VBA

Posted on 2012-08-26
2
Medium Priority
?
1,101 Views
Last Modified: 2012-08-26
Hello All,

I have a dynamic range. I need a VBA to do the following:

ClearContent everything in that range but not do the clear content for the very first row of the dynamic range

Before:
a1      0
a2      0
a3      0
a4      0
a5      0
a6      0
a7      0
a8      0


after clear content > that clears everything except the first row of the dynamic range
a1      0



How do I do it via VBA?
Thank you
ClearRangeButDontDestroyIt.xlsm
0
Comment
Question by:Rayne
2 Comments
 
LVL 18

Accepted Solution

by:
krishnakrkc earned 2000 total points
ID: 38335534
Hi

try

With Range("MyRange") '<< adjust the range name
    .Cells(1).Offset(1).Resize(.Rows.Count - 1, .Columns.Count).ClearContents
End With

Open in new window


Kris
0
 

Author Comment

by:Rayne
ID: 38335542
Thank you Kris,
This works perfect
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
I came across an unsolved Outlook issue and here is my solution.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question