Replace text in a specfic cell

Gregfox

Board Regular
Joined
Apr 12, 2011
Messages
120
I would like to replace some text in a specfic cell, the cell contains thr following;
'As of Sep 4 2018'

I would like to replace 'As of' with blank that is I want to remove 'As of'

using Excel 2007 on a PC
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
If you want to do it in the cell itself (and not in another column), just use Excel's built-in Find/Replace functionality replacing "As of " with nothing.
 
Upvote 0
Sorry, I forgot to add "I'm using VBA"
Turn on your Macro Recorder and record yourself using the Find/Replace functionality I mentioned above, and you will have VBA code that does that.
 
Upvote 0
If it's just one cell try
Code:
Range("A8").Value = Split(Range("A8").Value, "of")(1)
or
Code:
Range("A8").Value = CDate(Split(Range("A8").Value, "of")(1))
to convert to a date
 
Upvote 0
If it's just one cell try
Code:
Range("A8").Value = Split(Range("A8").Value, "of")(1)
or
Code:
Range("A8").Value = CDate(Split(Range("A8").Value, "of")(1))
to convert to a date

Sorry for this being irrelevant to OP question but ....

Does Split put items into an array of some sort? and is the (1) calling the second index of that array which in this case would be the date?
 
Upvote 0
Sorry for this being irrelevant to OP question but ....

Does Split put items into an array of some sort? and is the (1) calling the second index of that array which in this case would be the date?

Yes, that is correct. Just so you know, the Split function always produces a zero-based array (meaning first element's index number is 0) even if the Option Base 1 setting is used.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,967
Members
452,371
Latest member
Frana

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