Help with import Excel cell value in datagridview

  • Thread starter Thread starter BlackSun
  • Start date Start date
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
 
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
 
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
 
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
 
Back
Top