how can i place blank on entire column value contains "00-01-1900" through VBA

m_vishal_c

Board Regular
Joined
Dec 7, 2016
Messages
209
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
HI. I want to place blank (" ") on entire column . there are so many "00-01-1900" values . so i want to replace as blank (" "). is it possible by VBA.

Please guide me

heaps thanks in advance
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Hi,

This will replace "00-01-1900" with ""

Just change the column number to the column you need to replace in.

Code:
Sub Replace()

Dim rownum As Long
Dim colnum As Long


rownum = 1
colnum = 1 'change to reflect column you are changing 1=A, 2=B etc


Do Until rownum = ActiveSheet.UsedRange.Rows.Count + 1
    Cells(rownum, colnum).Replace What:="00-00-1900", Replacement:=" ", LookAt:=xlPart, _
        SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
        ReplaceFormat:=False
    rownum = rownum + 1
Loop


End Sub
 
Upvote 0
Hi,

This will replace "00-01-1900" with ""

Just change the column number to the column you need to replace in.

Code:
Sub Replace()

Dim rownum As Long
Dim colnum As Long


rownum = 1
colnum = 1 'change to reflect column you are changing 1=A, 2=B etc


Do Until rownum = ActiveSheet.UsedRange.Rows.Count + 1
    Cells(rownum, colnum).Replace What:="00-00-1900", Replacement:=" ", LookAt:=xlPart, _
        SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
        ReplaceFormat:=False
    rownum = rownum + 1
Loop


End Sub


sorry , it does not work
 
Upvote 0
That's odd. Maybe a version issue as I have no problems with it.

Does this work?

Code:
Sub Replace()

    Cells.Replace What:="00-01-1900", Replacement:=" ", LookAt:=xlPart, _
        SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
        ReplaceFormat:=False




End Sub
 
Upvote 0
That's odd. Maybe a version issue as I have no problems with it.

Does this work?

Code:
Sub Replace()

    Cells.Replace What:="00-01-1900", Replacement:=" ", LookAt:=xlPart, _
        SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
        ReplaceFormat:=False




End Sub
does it count all entire workbook or particular column. but need to assign column count no.
 
Upvote 0
Just the active sheet. Wanted to try and work out where the other code is failing.

If it replaces all in the sheet the other code should work if the correct column is being inputted.

This is out of my depth if that is not the case i'm afraid.
 
Upvote 0
hi i don't mind if it changes active sheet. but still it does not get changed, still it shows 00-01-1900 value in cell.
 
Upvote 0
Please take a minute to read the forum rules, especially related to cross-posting, and then comply with them. Thanks.
 
Upvote 0

Forum statistics

Threads
1,221,446
Messages
6,159,917
Members
451,603
Latest member
SWahl

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top