Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Range.Value2 is failing for lenghty strings

Hi,
I am trying to assign values to range using an array, however, it is
failing when one of the cell values are going beyone 930+ chars.
I have the below code trying to assign an DataTable itemarray to the range...

//insertRange is an Excel.Range object
insertRange.Value2 = _myDataTable.Rows[i].ItemArray;


The above code is working fine as long as the itemArray contains values less
than 930 characters ( I have not really arrived at the number exactly when it
is failing). Can you please let me know why Value2 property is failing in
this long string case?
or how can I set the length of the cell/listColumn?
Please help.
Thanks,
Naresh
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Range.Value2 is failing for lenghty strings

Naresh,
XL2K, this works:
ActiveCell.Value2 = String(1000, "c")
MsgBox Len(ActiveCell.Value2)

Maybe the problem is with the source of your data rather than Excel ?

NickHK

"Naresh Mirkhelkar" wrote in
message ...
Hi,
I am trying to assign values to range using an array, however, it is
failing when one of the cell values are going beyone 930+ chars.
I have the below code trying to assign an DataTable itemarray to the

range...[i]

//insertRange is an Excel.Range object
insertRange.Value2 = _myDataTable.Rows.ItemArray;


The above code is working fine as long as the itemArray contains values

less
than 930 characters ( I have not really arrived at the number exactly when

it
is failing). Can you please let me know why Value2 property is failing in
this long string case?
or how can I set the length of the cell/listColumn?
Please help.
Thanks,
Naresh



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Range.Value2 is failing for lenghty strings

Hi Nick,
It is working when Data is provided for individual cells, but not when data
is set to the Range object directly as mentioned in my mail below.
Thanks,
Naresh

"NickHK" wrote:
[i]
Naresh,
XL2K, this works:
ActiveCell.Value2 = String(1000, "c")
MsgBox Len(ActiveCell.Value2)

Maybe the problem is with the source of your data rather than Excel ?

NickHK

"Naresh Mirkhelkar" wrote in
message ...
Hi,
I am trying to assign values to range using an array, however, it is
failing when one of the cell values are going beyone 930+ chars.
I have the below code trying to assign an DataTable itemarray to the

range...

//insertRange is an Excel.Range object
insertRange.Value2 = _myDataTable.Rows.ItemArray;


The above code is working fine as long as the itemArray contains values

less
than 930 characters ( I have not really arrived at the number exactly when

it
is failing). Can you please let me know why Value2 property is failing in
this long string case?
or how can I set the length of the cell/listColumn?
Please help.
Thanks,
Naresh




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Range.Value2 is failing for lenghty strings

Naresh,
Still works
Set rng = ActiveCell
rng.Value2 = String(1000, "c")


NickHK


"Naresh Mirkhelkar" wrote in
message ...
Hi Nick,
It is working when Data is provided for individual cells, but not when

data
is set to the Range object directly as mentioned in my mail below.
Thanks,
Naresh

"NickHK" wrote:

Naresh,
XL2K, this works:
ActiveCell.Value2 = String(1000, "c")
MsgBox Len(ActiveCell.Value2)

Maybe the problem is with the source of your data rather than Excel ?

NickHK

"Naresh Mirkhelkar" wrote

in[i]
message ...
Hi,
I am trying to assign values to range using an array, however, it is
failing when one of the cell values are going beyone 930+ chars.
I have the below code trying to assign an DataTable itemarray to the

range...

//insertRange is an Excel.Range object
insertRange.Value2 = _myDataTable.Rows.ItemArray;


The above code is working fine as long as the itemArray contains

values
less
than 930 characters ( I have not really arrived at the number exactly

when
it
is failing). Can you please let me know why Value2 property is failing

in
this long string case?
or how can I set the length of the cell/listColumn?
Please help.
Thanks,
Naresh






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Range.Value2 is failing for lenghty strings

Hi Nick,
In your case, the range is still containing only one cell. In my case,
Range contains 4 columns (cells). I tried the way you have described, but it
worked only when I assigned values to individual cells as below...

object[] rowData = _myDataTable.Rows[i].ItemArray;
for (int k=0; k < rowData.Length ; k++{
insertRange.Cells[1,k+1] = rowData[k]
}

....and also doing the above way is affecting performance.

Thank you for extending your help.

Thanks,
Naresh
"NickHK" wrote:
[i]
Naresh,
Still works
Set rng = ActiveCell
rng.Value2 = String(1000, "c")


NickHK


"Naresh Mirkhelkar" wrote in
message ...
Hi Nick,
It is working when Data is provided for individual cells, but not when

data
is set to the Range object directly as mentioned in my mail below.
Thanks,
Naresh

"NickHK" wrote:

Naresh,
XL2K, this works:
ActiveCell.Value2 = String(1000, "c")
MsgBox Len(ActiveCell.Value2)

Maybe the problem is with the source of your data rather than Excel ?

NickHK

"Naresh Mirkhelkar" wrote

in
message ...
Hi,
I am trying to assign values to range using an array, however, it is
failing when one of the cell values are going beyone 930+ chars.
I have the below code trying to assign an DataTable itemarray to the
range...

//insertRange is an Excel.Range object
insertRange.Value2 = _myDataTable.Rows.ItemArray;


The above code is working fine as long as the itemArray contains

values
less
than 930 characters ( I have not really arrived at the number exactly

when
it
is failing). Can you please let me know why Value2 property is failing

in
this long string case?
or how can I set the length of the cell/listColumn?
Please help.
Thanks,
Naresh








Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Not finding value, range method failing davegb Excel Programming 9 March 6th 06 03:40 PM
changelink with the name and new name as strings is failing whylite Excel Programming 1 February 17th 06 05:08 AM
select method of range class failing ? mark kubicki Excel Programming 6 April 21st 05 05:38 PM
Lookup Value2 Len Excel Programming 11 April 17th 05 11:50 AM
Activecell.value or value2? Sirin Excel Programming 2 November 22nd 04 12:01 PM


All times are GMT +1. The time now is 09:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"