Solved

Clear Data and Delete Column

Posted on 2011-02-25
2
208 Views
Last Modified: 2012-08-13
Hi Experts,

I would like to request Experts help create a macro to clear all data and delete column starts with  “Status” as a header at “Validation2” sheet. I have attached the workbook for Experts perusal. Hope Experts will help me to create this function.



DeleteData.xls
0
Comment
Question by:Cartillo
2 Comments
 
LVL 24

Accepted Solution

by:
StephenJR earned 500 total points
ID: 34978427
If I understand correctly...
Sub x()
  
Dim rFind As Range
 
With Sheets("Validation2")
    .Range("A1").CurrentRegion.Offset(1).ClearContents
    Set rFind = .Rows(1).Find(What:="Status", LookAt:=xlWhole, MatchCase:=False, SearchFormat:=False)
    If Not rFind Is Nothing Then
        Do
            rFind.EntireColumn.Delete shift:=xlToLeft
            Set rFind = .Rows(1).Find(What:="Status", LookAt:=xlWhole, MatchCase:=False, SearchFormat:=False)
        Loop Until rFind Is Nothing
    End If
End With
     
End Sub

Open in new window

0
 

Author Closing Comment

by:Cartillo
ID: 34985657
Hi,

Thanks a lot for the help.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delete all words in cell more than 5 words 7 47
vba in excel to send reply for sent email including original message 2 64
ADD New Entries 7 15
Update As Well As Add 6 35
INDEX and MATCH can be used to great effect to replace HLOOKUP and VLOOKUP as it does not have the limitation of needing the data to be sorted so that the reference value is in the first column or row. It also has the ability to perform a bi-directi…
Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

919 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now