Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7826371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T09:22:47+00:00 2026-06-02T09:22:47+00:00

I have a vba function in excel 2010 that I built using help from

  • 0

I have a vba function in excel 2010 that I built using help from people on here. This function copies the contents of a table/form, sorts them, and sends them to the appropriate tables.

Now after running this function I want the original table to be cleared. I can achieve this with the following code, assuming ACell has been defined as the first cell in the table.
ACell.ListObject.Range.ClearContents works fine, the only problem is it deletes the table as well as the data values.

Is there any way around this? I would rather not have to set the table up every time I enter some data.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T09:22:48+00:00Added an answer on June 2, 2026 at 9:22 am

    How about:

    ACell.ListObject.DataBodyRange.Rows.Delete
    

    That will keep your table structure and headings, but clear all the data and rows.

    EDIT: I’m going to just modify a section of my answer from your previous post, as it does mostly what you want. This leaves just one row:

    With loSource
       .Range.AutoFilter
       .DataBodyRange.Offset(1).Resize(.DataBodyRange.Rows.Count - 1, .DataBodyRange.Columns.Count).Rows.Delete
       .DataBodyRange.Rows(1).Specialcells(xlCellTypeConstants).ClearContents
    End With
    

    If you want to leave all the rows intact with their formulas and whatnot, just do:

    With loSource
       .Range.AutoFilter
       .DataBodyRange.Specialcells(xlCellTypeConstants).ClearContents
    End With
    

    Which is close to what @Readify suggested, except it won’t clear formulas.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Excel VBA function that takes a number of optional parameters, including
I am porting Excel VBA to VB.NET. I have a function that takes a
I have a VBA Word Macro that gets words from .txt list and color
I have a VBA script that inserts long strings into Excel cells. In some
I have an Excel VBA Script I've written with help, I am not a
I have written a VBA macro in an excel spreadsheet that opens all workbooks
I'm using Excel VBA and have a worksheet_change event like so: Private Sub Worksheet_Change(ByVal
I have an EXCEL VBA function which should return the address of the first
Hi I'm using VBA in Excel and need to pass in the values from
In Excel, I'm writing a custom function in VBA that needs to take a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.