View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Myrna Larson Myrna Larson is offline
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