Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default R1C1 vs A1 addressing

Hi All,

I am trying to drive excel from VC++.net and would like to insert data into
a range addressed using the R1C1 style. Here is how I know it works (from
the SDK samples):

Range* range2 = worksheet-get_Range(S"A1", S"E1");
int array2 __gc[] = new int __gc[5];
for (int i=0; i < array2-GetLength(0); i++)
{
array2[i] = i+1;
}
range2-Value2 = array2;

My QUESTION is: how can I change the addressing from "A1" / "E1" to R1C1 /
R1C5. If I just replace the strings it fails.

Hope someone can HEEEELP!!!

Fizikus




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 863
Default R1C1 vs A1 addressing

I don't know C++, but you should look at the specs for the Get_Range
function/method. If it requires A1 syntax, you can't change that. So your
problem becomes how to translate an address like R1C5 into E1.

Here's a VBA function that translates a column number to the appropriate
letter. You'll have to translate it to C++.

Function ColumnLetter(Col As Integer) As String
Dim C As Integer
C = Col - 1
If C < 26 Then
ColumnLetter = Chr$(C + 65)
Else
ColumnLetter = Chr$(C \ 26 + 64) + Chr$(C Mod 26 + 65)
End If
End Function


On Sun, 01 Aug 2004 16:53:19 GMT, "netnews.comcast.net"
wrote:
[i]
Hi All,

I am trying to drive excel from VC++.net and would like to insert data into
a range addressed using the R1C1 style. Here is how I know it works (from
the SDK samples):

Range* range2 = worksheet-get_Range(S"A1", S"E1");
int array2 __gc[] = new int __gc[5];
for (int i=0; i < array2-GetLength(0); i++)
{
array2 = i+1;
}
range2-Value2 = array2;

My QUESTION is: how can I change the addressing from "A1" / "E1" to R1C1 /
R1C5. If I just replace the strings it fails.

Hope someone can HEEEELP!!!

Fizikus




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default R1C1 vs A1 addressing

Thanks for the advice -- I guess I have to use some workaround. I wanted to
make sure that those who know how to do it would follow the same route...

Regards, Fizikus

"Myrna Larson" wrote in message
...
I don't know C++, but you should look at the specs for the Get_Range
function/method. If it requires A1 syntax, you can't change that. So your
problem becomes how to translate an address like R1C5 into E1.

Here's a VBA function that translates a column number to the appropriate
letter. You'll have to translate it to C++.

Function ColumnLetter(Col As Integer) As String
Dim C As Integer
C = Col - 1
If C < 26 Then
ColumnLetter = Chr$(C + 65)
Else
ColumnLetter = Chr$(C \ 26 + 64) + Chr$(C Mod 26 + 65)
End If
End Function


On Sun, 01 Aug 2004 16:53:19 GMT, "netnews.comcast.net"


wrote:

Hi All,

I am trying to drive excel from VC++.net and would like to insert data

into[i]
a range addressed using the R1C1 style. Here is how I know it works (from
the SDK samples):

Range* range2 = worksheet-get_Range(S"A1", S"E1");
int array2 __gc[] = new int __gc[5];
for (int i=0; i < array2-GetLength(0); i++)
{
array2 = i+1;
}
range2-Value2 = array2;

My QUESTION is: how can I change the addressing from "A1" / "E1" to R1C1

/
R1C5. If I just replace the strings it fails.

Hope someone can HEEEELP!!!

Fizikus






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
Addressing in VBA Richard Excel Discussion (Misc queries) 1 January 23rd 08 01:40 AM
help on Converting R1C1 to A1 and A1 to R1C1..tia sa2 temp Excel Discussion (Misc queries) 3 September 13th 07 08:31 AM
help on Converting R1C1 to A1 and A1 to R1C1..tia sa2 temp Excel Worksheet Functions 3 September 13th 07 08:31 AM
Sorksheet addressing (I think) in '97 Adam Kroger Excel Discussion (Misc queries) 0 November 27th 05 10:29 PM
two D addressing? lookup? Thrava Excel Discussion (Misc queries) 5 December 3rd 04 08:19 AM


All times are GMT +1. The time now is 03:42 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"