Link to home
Start Free TrialLog in
Avatar of chkueh
chkuehFlag for Singapore

asked on

How to add " ' " when transferring DataGrid data to Excel?

Hi, Experts,
I would like to add " ' " in the excel cell to avoid zero missing for number format, for example (000123). I want whole number to be displayed in the  excel cell, without " ' " in excel the number will become (123) only.
Previously, i add Section A code to add " ' "  to get whole number displayed, but now is i cannot add " ' " for code in Section B.
Can any one tell me how to add " ' " before dr("No") ?

Thank you.
Best Regards,
--chkueh--
Section A:
Dim No As String = Trim(txtNo.Text)
excelWorksheet.Range("C4").Value = "'" & No 
 
Section B:
.Range("B" & i.ToString).Value = dr("No")
.Range("B" & i.ToString).HorizontalAlignment = Excel.Constants.xlLeft

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of ioane
ioane
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of chkueh

ASKER

Excellent job. Thank you very much.