# Format Problems

1. ## Format Problems

Hello!

Im finding some problems with formats in my workbook that I hope someone can help me to find where the error is cause I cannot see it...

I prefer to attach the file so that you can better see what I mean.

If you just open the workbook and run the macro, you will see in the ListBox there are numbers with plenty of decimals. Those should be whole numbers but dont know why they are displayed like that...

I would appreciate if someone could take a small look to what I mean.

Thank you very much!!

Regards,

2. ## Re: Format Problems

Hola pezalmendra,

The problem is the formatted number displayed is not the same as the internally stored value. Since a LitBox control can only hold strings, the fix is an easy. Instead of loading the cell's Vlaue property, load the Text Property. Here is the macro with the correction in bold.

``Please Login or Register  to view this content.``

3. ## Re: Format Problems

Excellent Leith!! Problem solved in the ListBox!! )

But... do you know why for example Cell(L13) that comes by the difference between K13 - J13 gives me those decimals when they are both whole number?

Also, I have now notice that the values stored in Column D are not as they should be (should be like in Column E)

This is the code Im using for it: Cells(FilaActual, 4).Value = CDate(Cells(FilaActual, 3).Value) + CDate(Cells(FilaActual, 45).Value)

Thanks Leith like always for your time and attention!!!

Regardss

4. ## Re: Format Problems

Hello penzalmendra,

VBA stores a Date and Time as a single number. The Date is the integer part and the Time is the fractional part of the number. The date starts from December 31, 1899 or 1. The time is in seconds since midnight or zero hours. One second would be 1/86400.

The values in column "C" are Time values (decimal fractions). These can be added directly to the Date in column "B" to produce a "complete" date/time value. The values in column "AS" need to be converted from an integer into a Time value in hours before it can be added to the date/time sum of "B" and "C". This done using the TimeSerial method. This converts Hours, Minutes and Seconds into a fractional Time value.

Corrected Equation
``Please Login or Register  to view this content.``

5. ## Re: Format Problems

OK!!

Great! SOLVED the problem

Regards

6. ## Re: Format Problems

Hola penzalmendra,

Todo es fácil una vez que sepa cómo hacerlo. Verdad?

7. ## Re: Format Problems

Hola!

Tienes razón! Yo estoy empezando con esto y me cuesta bastante la verdad... me paso todo el día preguntando... hehehe

Ahora estoy peleándome con una macro que creo que no tardaré mucho en preguntarte!!! La tengo bastante avanzada pero no consigo avanzar más

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1