We help IT Professionals succeed at work.

Excel VBA: Replace values in Listobject

771 Views
Last Modified: 2017-04-03
I am importing some data with a MS QUERY from another workbook and the data is put into a table called CUSTOMERS.

The listobject has several columns and one of them is "First Order Date".
There is one value that I want to remove (not hide with a cell format): 00.01.1900  00:00:00

Is there a neat way to delete this value in the entire listobject with VBA?
I do not mind if the data is converted to a string if that makes it easier and the cell is empty

Thanks

Massimo
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2016

Commented:
Hi,

pls try
Sub Macro1()
Application.ScreenUpdating = False
For Each c In Range("Table1[First Order Date]")
    If c.Value = 0 Then
        c.ClearContents
    End If
Next
Application.ScreenUpdating = True
End Sub

Open in new window

Regards
ShumsManaging Director/Excel VBA Developer
CERTIFIED EXPERT
Distinguished Expert 2018
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION
CERTIFIED EXPERT
Top Expert 2016
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION
Massimo ScolaSoftware Engineer

Author

Commented:
Thanks guys ..the codes work like a charm.
ShumsManaging Director/Excel VBA Developer
CERTIFIED EXPERT
Distinguished Expert 2018

Commented:
You're Welcome Massimo! We're glad we're able to help
Massimo ScolaSoftware Engineer

Author

Commented:
I do have one more follow up question though ..

What if I want to apply this code to every column of the listobject?
How would you amend the code?
ShumsManaging Director/Excel VBA Developer
CERTIFIED EXPERT
Distinguished Expert 2018

Commented:
Do you want answer here or you gonna raise a new question?

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions