ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   What programming to use in VBA to convert in to number? (https://www.excelbanter.com/excel-programming/405791-what-programming-use-vba-convert-number.html)

Marco

What programming to use in VBA to convert in to number?
 
Hi. I'm creating a macro and in the many things that it should do I need that
selects me a few cells and then convert the content into Number.

I can do it manually, but it seems that when I'm creating a macro it don'd
record that step.

What can I do????? Any special programming?

Regards,
Marco

Mike H

What programming to use in VBA to convert in to number?
 
Hi,

You really haven't given a lot to go on but how about this for a start:

Sub stance()
Range("A1:A20").Select
For Each c In Selection
On Error Resume Next
c.Value = c.Value + 0
c.NumberFormat = "General"
Next
End Sub

Mike

"Marco" wrote:

Hi. I'm creating a macro and in the many things that it should do I need that
selects me a few cells and then convert the content into Number.

I can do it manually, but it seems that when I'm creating a macro it don'd
record that step.

What can I do????? Any special programming?

Regards,
Marco


Marco

What programming to use in VBA to convert in to number?
 
I think it works.

YOU A STAR.....


Cheers,
Marco



"Mike H" wrote:

Hi,

You really haven't given a lot to go on but how about this for a start:

Sub stance()
Range("A1:A20").Select
For Each c In Selection
On Error Resume Next
c.Value = c.Value + 0
c.NumberFormat = "General"
Next
End Sub

Mike

"Marco" wrote:

Hi. I'm creating a macro and in the many things that it should do I need that
selects me a few cells and then convert the content into Number.

I can do it manually, but it seems that when I'm creating a macro it don'd
record that step.

What can I do????? Any special programming?

Regards,
Marco


Mike H

What programming to use in VBA to convert in to number?
 
Well I'm surprised and pleased in equal measure. Thanks for the feedback.

Mike

"Marco" wrote:

I think it works.

YOU A STAR.....


Cheers,
Marco



"Mike H" wrote:

Hi,

You really haven't given a lot to go on but how about this for a start:

Sub stance()
Range("A1:A20").Select
For Each c In Selection
On Error Resume Next
c.Value = c.Value + 0
c.NumberFormat = "General"
Next
End Sub

Mike

"Marco" wrote:

Hi. I'm creating a macro and in the many things that it should do I need that
selects me a few cells and then convert the content into Number.

I can do it manually, but it seems that when I'm creating a macro it don'd
record that step.

What can I do????? Any special programming?

Regards,
Marco



All times are GMT +1. The time now is 05:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com