ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   having trouble writing string to cell-xl2k (https://www.excelbanter.com/excel-programming/327443-having-trouble-writing-string-cell-xl2k.html)

Terry Carpenter[_2_]

having trouble writing string to cell-xl2k
 
Hello!
I have some code that writes from an array to a cell. The
problem is that sometimes the string may have hyphen characters in it
which seems to cause excel to assume it's a formula. This causes out
of memory errors because the string may be very long. I've tried
setting the cell to be text before writing to it but xl still wants to
make it a formula. If I remove the hyphens it works fine but I don't
want to do that. This is the code I'm using:

'start code

rCell.Offset(i, 8).NumberFormat = "@"
rCell.Offset(i, 8).Value = udtDr(i).string(j)

'udtDr is user defined type

'end code

Thanks!



Terry Carpenter[_2_]

having trouble writing string to cell-xl2k
 
Hey that works great -Thanks!

On Thu, 14 Apr 2005 10:06:03 -0700, DragonDom
wrote:

Try concatenating a single quotation mark( ' ) before the string before
writing to the cell.

"Terry Carpenter" wrote:

Hello!
I have some code that writes from an array to a cell. The
problem is that sometimes the string may have hyphen characters in it
which seems to cause excel to assume it's a formula. This causes out
of memory errors because the string may be very long. I've tried
setting the cell to be text before writing to it but xl still wants to
make it a formula. If I remove the hyphens it works fine but I don't
want to do that. This is the code I'm using:

'start code

rCell.Offset(i, 8).NumberFormat = "@"
rCell.Offset(i, 8).Value = udtDr(i).string(j)

'udtDr is user defined type

'end code

Thanks!






All times are GMT +1. The time now is 03:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com