VBA to convert the range B in number format??

rohitw2

New Member
Joined
Mar 24, 2017
Messages
9
Hi All,

I need a help where I have the numbers in column B but they are not in the number format. So I want the moment my macro paste the data in column B, it should convert that column in number format. I have tried multiple time but it only paste the data in as usual format.

Kindly advise

[TABLE="class: grid, width: 150"]
<tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]Date[/TD]
[TD]Amt[/TD]
[/TR]
[TR]
[TD]25-03-17[/TD]
[TD]500[/TD]
[/TR]
[TR]
[TD]15-02-17[/TD]
[TD]6985[/TD]
[/TR]
[TR]
[TD]20-03-17[/TD]
[TD]84[/TD]
[/TR]
[TR]
[TD]12-01-17[/TD]
[TD]7321[/TD]
[/TR]
</tbody>[/TABLE]

 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Have you tried using the Macro Recorder to generate the VBA you need?
 
Upvote 0
Hi All,

I need a help where I have the numbers in column B but they are not in the number format. So I want the moment my macro paste the data in column B, it should convert that column in number format.

Add these two lines of code immediately after the code that puts the numbers in Column B...

Columns("B").NumberFormat = "General"
Columns("B").TextToColumns
 
Upvote 0
will this make my data in column B in number format as i have to use it for my further calculations.
 
Upvote 0
will this make my data in column B in number format as i have to use it for my further calculations.
The cells will be formatted as General (the default for cells in Excel) so the code I gave you would result in the cell containing a real number if the text in the cell is a proper representation of a number (just like if you had typed it in manually).
 
Upvote 0
https://1drv.ms/i/s!ArrD_eUdmgj1jgQcqBO4mpV0uv_z

I have
share the snap shot link kindly look into it where i need to do the convert all items in range in number format without using the mouse.
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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