VBA - decimal separator issue

togo

New Member
Joined
Apr 13, 2021
Messages
7
Office Version
  1. 365
Platform
  1. Windows
Hi, I have a data set in the html page looking as table containing numbers, dates, times, strings etc. each in separate column. I'm trying to copy this data set to excel and format it as I want with VBA. The only problem I have is that the source data set is using DOT "." as decimal separator and I want to use COMMA "," instead - according to my regional settings of Windows, excel is not considering DOT separated numbers as numbers.

I can do:
VBA Code:
Selection.Replace What:=".", Replacement:=","
but after that, I'm getting errors for each cell - number formatted as text.decimal number.
1618292459302.png

How can I format it as number by VBA? When I replace DOT with COMMA by GUI Find and replace function it is formatted correctly as COMMA separated decimal number.
 
The code I posted is not the same as the one you posted. Note that the replacement in my code is also a dot, not a comma.
Sorry, I didn't notice the difference, but actually this solved the problem, thanks.
 
Upvote 0

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Forum statistics

Threads
1,223,891
Messages
6,175,229
Members
452,621
Latest member
Laura_PinksBTHFT

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