How to convert currency formatting to "no formatting" using VBA

Brutusar

Board Regular
Joined
Nov 23, 2019
Messages
166
Office Version
  1. 365
Platform
  1. Windows
Hi everyone,

I have a sheet with prices in currency format in col A. I need to loop thru it and get the currency (three letter code) in col B, and the sum in col C.
Does someone have a good ide on how to best to that?

Eks:

ABC
$65.60USD65.60
€25.50EUR25.50
£10.00GBP10.00
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
If u want the "USD" instead of just the symbol you can do a vlookup by getting all the symbols and their codename.

VBA Code:
Sub Currency_101()
        
        Dim rng As Range
        For Each rng In Selection
                rng.Offset(0, 1) = Left(rng.Text, 1)
                rng.Offset(0, 2) = rng.Value2
        Next rng

End Sub
 

Attachments

  • 1674385766053.png
    1674385766053.png
    14.7 KB · Views: 6
Upvote 0
Sub Currencytext()

Dim rng As Range
Dim LU As Variant
Dim Curr As String

For Each rng In Selection
LU = Left(rng.Text, 1)
Curr = Application.VLookup(LU, Sheet3.Range("E7:F9"), 2, 0)
rng.Offset(0, 1) = Curr
rng.Offset(0, 2) = rng.Value2
Next rng

End Sub

Book1
ABCDEF
6
7$65.60USD65.60$USD
8€ 25.50EUR25.50EUR
9£10.00GBP10.00£GBP
10
Sheet3
 
Upvote 0

Forum statistics

Threads
1,223,912
Messages
6,175,340
Members
452,638
Latest member
Oluwabukunmi

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