excel自定义格式单元格读取 [英] excel custom format cell reading
问题描述
大家好,
任何人都有正确的语法可以读取excel文件中的自定义格式单元格?
如果我读取了值为"03/04/2012 13:38"的单元格,则返回"04/03/2012 13:38"
有人怎么能告诉我他的语法可以返回正确的单元格值?
hello guys,
anybody their has the right syntax to read the custom format cell in an excel file??
if i read the cell that has a value "03/04/2012 13:38" it returns "04/03/2012 13:38"
how can someone show me he syntax to return the right what is in the cell value???
推荐答案
我只会使用VB的 Format 函数可根据需要进行查看.
我一直在为Excel工作簿开发自己的项目,因此我正在使用其中的一部分.
类似于{在VB2005中}:
I would just use VB''s Format function to view it however you like.
I''ve been working on my own project for an Excel workbook so I''m using part of what I have in that.
Something like {in VB2005 anyway}:
odSheet(1) = odWrkBk.Worksheets("Guests")
myDate = Format(odSheet(1).Cells(fR, 3).Value, "dd/MM/yyyy HH:mm")
MsgBox(myDate)
这将显示您发布的那个单元格中的日期.大写字母"H"表示24小时制,如果您想使用12小时制,请使用小写字母.
如果这与VB6中的内容不同,我深表歉意.格式应该工作相同,我认为,这是我上面代码中可以使用的重要部分.
希望这会有所帮助!
给您和您的和平,
Matthew"Dra" Gon"Stohler
This would show whatever the date is in that cell as what you posted. The capital "H" is for 24-hour format and if you want the 12-hour format just use lower-case.
I appollogize if this isn''t the same as in VB6. The Format should work just the same and that, I believe, is the important portion of my code above that you could use.
Hope this helps!
Peace to you and yours,
Matthew "Dra''Gon" Stohler
这篇关于excel自定义格式单元格读取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!