Help with import Excel cell value in datagridview

B

BlackSun

Hi,
I have a problem when I copy values from cells of Excel and insert
them into a DataGridView.
In Excel I have a cell with a custom format ("ddd"), in the cell
there's the date but I see "sun" (cell formatted with "ddd"
How can I copy "sun" in the DataGridView and not the date??

Thanks in advance!

Cheers BlackSun
 
O

OmegaSquared

Hello, BlackSun,

If you use the cell's Value property (instead of its Text property) I think
you will get what you need.

Cheers,
Randy
 
B

BlackSun

Hi,
Thank you for your reply.
You gave me a good way to resolve it.
It works in this way:

Grid.Item(1, 1).Value = CType(mySheet.Cells(15,29), Excel.Range).Text

In the wrong version I used CType(mySheet.Cells(15,29),
Excel.Range).Value

Thank you very much!

Bye BlackSun
 
O

OmegaSquared

Hello, BlackSun,

Yes, sorry about that. I read your original post too quickly and thought
you wanted to get the date back instead of the day. I'm glad you were able
to sort it out despite that confusion.

Cheers,
Randy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top