change "two points" by a comma

elsg

Active Member
Joined
Mar 16, 2013
Messages
295
Hi.
how do I change "two points" by a comma?
Code:
Sub test()    [B2].Value = Replace([A2].Value, ":", ",")
End Sub

Ex:
196:35:00 --> 196,35
76:46:00 ---> 76,46
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Hi.
how do I change "two points" by a comma?
Code:
Sub test()    [B2].Value = Replace([A2].Value, ":", ",")
End Sub

Ex:
196:35:00 --> 196,35
76:46:00 ---> 76,46
The main question I have, for now, is what is actually in cell A2 right now... 196:35:00 as Text or 1/8/1900 5:35:00 AM as a date? Select cell A2, look at the Formula Bar and post back what you saw.
 
Upvote 0
Given the above perhaps:

Code:
B2: 
=TEXT(A2,"[hh],mm")

Assuming you want as a literal string else adjust format of A2 to [hh],mm
 
Upvote 0
Given the above perhaps:

Code:
B2: 
=TEXT(A2,"[hh],mm")

Assuming you want as a literal string else adjust format of A2 to [hh],mm
Correct... that is what I was expecting would be the answer when I asked my question; although I was thinking only one h inside the square brackets (not sure the OP would actually want to see leading zeroes, but I could be wrong on that).
 
Upvote 0

Forum statistics

Threads
1,213,551
Messages
6,114,268
Members
448,558
Latest member
aivin

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