Solved

Clear column

Posted on 2011-02-11
9
254 Views
Last Modified: 2012-05-11
Hello Experts,

Can someone please let me know if there are quick ways clear the contents within a column.

Basically, I'm constantly deleting/clearing the contents in a column and inserting new data from a new sheet.

So for example, in the attached spreadsheet I would clear all the symbols in column A sheet 1 and then go to sheet 2 copy the stock symbols in one of the columns and paste it into column A in sheet 1. I continue doing this until I've gone through all the symbols in sheet 2.

As you can imagine this can become quite a laborious task.

If you can help that would be greatly appreciate.

Thanks in advance.

Cheers

Carlton
delete-column.xlsx
0
Comment
Question by:cpatte7372
  • 4
  • 3
9 Comments
 
LVL 85

Expert Comment

by:Rory Archibald
Comment Utility
Select A2, press Ctrl+Shift+down arrow, then delete?
0
 

Author Comment

by:cpatte7372
Comment Utility
Rory,

Thanks responding. I know my request makes me sound a little lazy but I was wondering if may be a macro could fulfill my request?
0
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 500 total points
Comment Utility
Sure:
Sub ClearColA()
   With Sheets("Sheet1")
      .Range("A2", .cells(.rows.count, "A").end(xlup)).ClearContents
   End With
End sub

Open in new window

0
 

Author Comment

by:cpatte7372
Comment Utility
Rory,

Thanks again mate for responding.

I'm very new to excel programming. Can you please tell me how to add your code to excel?

Cheers

Carlton
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Author Comment

by:cpatte7372
Comment Utility
Rory,

I just need to know how to insert the formula/commands you specified.

Cheers
0
 
LVL 85

Expert Comment

by:Rory Archibald
Comment Utility
1. Press Alt+f11 to open the Visual Basic Editor.
2. Locate your workbook in the Project Explorer window (top left usually), right-click it and choose Insert-Module.
3. Paste the code above into the blank code window that appears.
4. Save your file as a macro-enabled workbook (xlsm extension rather than xlsx)

You can then run the macro by pressing Alt+f8 to bring up the macros dialog box. In that dialog, you can also select the macro name from the list, click the Options... button and assign a shortcut key combination (such as Ctrl+Q) so that you can run it more easily.
0
 

Author Comment

by:cpatte7372
Comment Utility
Rory,

That worked a treat.

Cheers mate.
0
 
LVL 24

Expert Comment

by:broomee9
Comment Utility
This question has been classified as abandoned and is being closed as part of the Cleanup Program. See my comment at the end of the question for more details.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

A2 = A1 That kind of cell reference is relative.  If you copy it from A2 to B2, then B2 will get this: B2 = B1 That's all fine and good, but if you then insert a new row above row 2, you'll find: A3 = A1 B3 = B1 This is intentional. …
Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

772 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

14 Experts available now in Live!

Get 1:1 Help Now