ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   simple problem with values in cells (https://www.excelbanter.com/excel-programming/299945-simple-problem-values-cells.html)

Joachim[_2_]

simple problem with values in cells
 
Hi all,
I use the following code to fill some values into cells

Range("CA6").Select
Range("CA6") = "3.2745"
Range("CA7").Select
Range("CA7") = "8.9355"
Range("CA8").Select
Range("CA8") = "8.9355"
Range("CA9").Select
Range("CA9") = "13.875"
Range("CA10").Select
Range("CA10") = "4.440"
Range("CA11").Select
Range("CA11") = "6.660"
-and more code-

everything works, but in cell CA6 I get 32745 and in cell CA7 I get 89355
:-(
The CA8 values is 8,9355 - what 's right :-)
The format of all cells are the same.

What can I do to geet also the both values in CA6 and CA7 in the right way ?

When I let a macro with specialy this part of code separatly it will works
?!?!

I use WINN XXP and XL2000 with SP3

Thanks for help ... joachim



Nigel[_8_]

simple problem with values in cells
 
There is no obvious problem with the code, except it could be more efficient
by assigning the values directly.
for example......

Range("CA6").Value = "3.2745"
Range("CA7").Value = "8.9355"

This must be a format problem with the cells involved, suggest you set the
format of each cell individually to the required format eg numeric with 4
decimal places. I assume of course you are using a period as a decimal
separator not a comma ?

Cheers
Nigel



"Joachim" wrote in message
...
Hi all,
I use the following code to fill some values into cells

Range("CA6").Select
Range("CA6") = "3.2745"
Range("CA7").Select
Range("CA7") = "8.9355"
Range("CA8").Select
Range("CA8") = "8.9355"
Range("CA9").Select
Range("CA9") = "13.875"
Range("CA10").Select
Range("CA10") = "4.440"
Range("CA11").Select
Range("CA11") = "6.660"
-and more code-

everything works, but in cell CA6 I get 32745 and in cell CA7 I get 89355
:-(
The CA8 values is 8,9355 - what 's right :-)
The format of all cells are the same.

What can I do to geet also the both values in CA6 and CA7 in the right way

?

When I let a macro with specialy this part of code separatly it will works
?!?!

I use WINN XXP and XL2000 with SP3

Thanks for help ... joachim





mudraker[_244_]

simple problem with values in cells
 
Joachim

When I tried you code in a brand new sheet all values were entered and
displayed as expected.

Suggest you try this code also in a new book and see if you get the
same results

Also to speed up your code and to shorten the amount of typing you do
you might want remove your code that selects each cell before entering
data into it so your code reads as this

Range("a6").Value = "3.2745"
Range("a7") .Value= "8.9355"
Range("a8").value= "8.9355"

etc


---
Message posted from http://www.ExcelForum.com/


Tom Ogilvy

simple problem with values in cells
 
don't use double quotes:

Range("CA6") = 3.2745
Range("CA7") = 8.9355
Range("CA8") = 8.9355
Range("CA9") = 13.875
Range("CA10") = 4.440
Range("CA11") = 6.660

--
Regards,
Tom Ogilvy


"Joachim" wrote in message
...
Hi all,
I use the following code to fill some values into cells

Range("CA6").Select
Range("CA6") = "3.2745"
Range("CA7").Select
Range("CA7") = "8.9355"
Range("CA8").Select
Range("CA8") = "8.9355"
Range("CA9").Select
Range("CA9") = "13.875"
Range("CA10").Select
Range("CA10") = "4.440"
Range("CA11").Select
Range("CA11") = "6.660"
-and more code-

everything works, but in cell CA6 I get 32745 and in cell CA7 I get 89355
:-(
The CA8 values is 8,9355 - what 's right :-)
The format of all cells are the same.

What can I do to geet also the both values in CA6 and CA7 in the right way

?

When I let a macro with specialy this part of code separatly it will works
?!?!

I use WINN XXP and XL2000 with SP3

Thanks for help ... joachim






All times are GMT +1. The time now is 07:34 PM.

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