In Excel VBA if a particular cell has been formatted to a
particular format such as as a custom date format.
If the value is being read or retrieve using VBA, VBA might
not be able to read the data as expected.
Example, Range B2 has been formatted to a custom format as
"h:mm AM/PM".
Range B2 has a value of 3:08 PM as displayed on excel
worksheet.
In VBA to retrieve the cell value, code could be:
Dim xval as variant
xval=range("B2").value
msgbox xval
Msgbox xval will not display as "3:08 PM", it
might be displayed as a decimal value because of the custom formatting set on
the cell.
To get the value as displayed on the cell, code can be
changed as:
Dim xval as Variant
xval=Range("B2").Text
Msgbox xval
Msgbox will display the value as seen on the excel
worksheet.
Cheers..Hope it helps..
=========================
Excel Keyboard shortcuts guide
https://play.google.com/store/apps/details?id=chrisjoms.myexcelapplicationguide
Heaven's Dew Fall
https://play.google.com/store/apps/details?id=soulrefresh.beautiful.prayer
Android Catholic Rosary App - Guide
https://play.google.com/store/apps/details?id=com.myrosaryapp&hl=en-GB
Educational App for Android Kids:
Free Version:
https://play.google.com/store/apps/details?id=com.xmultiplication
Paid Version:
https://play.google.com/store/apps/details?id=com.letsmultiply
https://play.google.com/store/apps/details?id=soulrefresh.beautiful.prayer
Android Catholic Rosary App - Guide
https://play.google.com/store/apps/details?id=com.myrosaryapp&hl=en-GB
Educational App for Android Kids:
Free Version:
https://play.google.com/store/apps/details?id=com.xmultiplication
Paid Version:
https://play.google.com/store/apps/details?id=com.letsmultiply
Comments
Post a Comment