MULTIPLY TEXT by 1: vba for multiplying text cells by 1 but do not return #VALUE!

itr674

Well-known Member
Joined
Apr 10, 2002
Messages
1,786
Office Version
  1. 2016
Platform
  1. Windows
Using this code to get rid of extra character but then need to multiply by 1 to calculate dates correctly...I'm still actively working it...

Public Sub Remove()
Dim oCell As Range
Range("B8:BU172").Select
For Each oCell In Selection
oCell.Value = Application.WorksheetFunction.Clean(oCell.Value)
oCell.NumberFormat = "yyyy mmm dd"
Next oCell
End Sub
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Using this code to get rid of extra character but then need to multiply by 1 to calculate dates correctly...I'm still actively working it...

Public Sub Remove()
Dim oCell As Range
Range("B8:BU172").Select
For Each oCell In Selection
oCell.Value = Val(Application.WorksheetFunction.Clean(oCell.Value))
oCell.NumberFormat = "yyyy mmm dd"
Next oCell
End Sub
Excel's CLEAN function is a text function, so it returns text to the cell. See if adding what I show in red above makes the code work the way you want.
 
Upvote 0
That code turns all cells to dates, so that seems not to work...
 
Upvote 0
The problem is some cells have N/A and then some cells are empty, well except for "return" character and spaces...I'm am still working it between other things...all this multi tasking is crazy...
 
Upvote 0
The problem is some cells have N/A and then some cells are empty, well except for "return" character and spaces...I'm am still working it between other things...all this multi tasking is crazy...
What do you want placed in the cells for the non-date values?
 
Upvote 0

Forum statistics

Threads
1,216,075
Messages
6,128,662
Members
449,462
Latest member
Chislobog

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