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,790
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

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
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,223,236
Messages
6,170,915
Members
452,366
Latest member
TePunaBloke

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