ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   conversion of text to numeric (https://www.excelbanter.com/excel-programming/364772-conversion-text-numeric.html)

Larry Empey[_2_]

conversion of text to numeric
 
In a macro I have the following code

Cells(rs, cl) = Cells(7, 19)

What can I change to this or add after it that will force the numbers
to be numeric instead of string?

Thank you
Larry

Tom Ogilvy

conversion of text to numeric
 
It normally isn't a problem, but if it is:

With Cells(rs, cl)
.NumberFormat = "General"
.Value = cdbl(Cells(7, 19).Value2)
End With


Assumes cells(7,19) contains a numeric value.
--
Regards,
Tom Ogilvy

"Larry Empey" wrote in message
...
In a macro I have the following code

Cells(rs, cl) = Cells(7, 19)

What can I change to this or add after it that will force the numbers
to be numeric instead of string?

Thank you
Larry




Larry Empey[_2_]

conversion of text to numeric
 
Tom

Thank you it works fine.
You said "It normally isn't a problem" which makes me wonder why it
is.
What I am doing is checking some cells in one part of the worksheet
and if they are < 10 then using cells = cells statement to copy them
to another part of the worksheet. But when I "read" them with another
if statement one or two (out of nine) will appear as "4" instead of 4
Is their something wrong with this method?

Larry



On Mon, 19 Jun 2006 22:53:42 -0400, "Tom Ogilvy"
wrote:

It normally isn't a problem, but if it is:

With Cells(rs, cl)
.NumberFormat = "General"
.Value = cdbl(Cells(7, 19).Value2)
End With


Assumes cells(7,19) contains a numeric value.




All times are GMT +1. The time now is 09:52 PM.

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