• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 270
  • Last Modified:

Clear column

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
cpatte7372
Asked:
cpatte7372
  • 4
  • 3
1 Solution
 
Rory ArchibaldCommented:
Select A2, press Ctrl+Shift+down arrow, then delete?
0
 
cpatte7372Author Commented:
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
 
Rory ArchibaldCommented:
Sure:
Sub ClearColA()
   With Sheets("Sheet1")
      .Range("A2", .cells(.rows.count, "A").end(xlup)).ClearContents
   End With
End sub

Open in new window

0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
cpatte7372Author Commented:
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
 
cpatte7372Author Commented:
Rory,

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

Cheers
0
 
Rory ArchibaldCommented:
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
 
cpatte7372Author Commented:
Rory,

That worked a treat.

Cheers mate.
0
 
TracyVBA DeveloperCommented:
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now