|
-
Jul 21st, 2006, 07:16 AM
#1
Thread Starter
Frenzied Member
Whats the syntax for R1C1 notation ?
I'm sure I am being very very dull, but I can't seem to set an R1C1 style address via code
I've got the following
VB Code:
tmpAddress = "R" & StoreRow & "C" & StoreCol
The value of tmpAddress is currently reading as "R7C1", and is defined as a string. Hmmm ... is THAT my problem .... defining it as a string ?
I'm trying to use it thus :
VB Code:
objexcel.Range(tmpAddress) = iGrid.CellText(iRow, 15)
but I'm getting "Method 'Range' of object'_Application' failed" errors
Can someone point out the error of my ways please.
-
Jul 21st, 2006, 07:17 AM
#2
Thread Starter
Frenzied Member
Re: Whats the syntax for R1C1 notation ?
I've also got "ReferenceStyle = xlR1C1" already set by the way, in case anyone asks.
Sorry should have mentioned that.
-
Jul 21st, 2006, 11:32 AM
#3
Addicted Member
Re: Whats the syntax for R1C1 notation ?
Had this problem before and I never found a way to solve the R1C1
but I did the following to solve my problem.
VB Code:
NewStoreRow = Chr(64 + StoreRow)
tmpAddress = NewStoreRow & StoreCol
But will not work if your column is higher than Z
Last edited by billhuard; Jul 21st, 2006 at 12:08 PM.
-
Jul 22nd, 2006, 01:17 AM
#4
Junior Member
Re: Whats the syntax for R1C1 notation ?
I've never used R1C1 referencing in this fashion. I've only used it in creating a string for a "FormulaR1C1 = " type of assignment statement.
That being said, this is the way the R1C1 string needs to look the way I use it:
R[7]C[1].
So I would try something like this:
Code:
tmpAddress = "R[" & StoreRow & "]C[" & StoreCol & "]"
I used to have a handle on life, but it broke.
-
Jul 22nd, 2006, 12:27 PM
#5
Re: Whats the syntax for R1C1 notation ?
If you want to reference a cell, why use a range?
VB Code:
objexcel.cells(storerow,storecol) = iGrid.CellText(iRow, 15)
zaza
-
Jul 24th, 2006, 02:47 AM
#6
Thread Starter
Frenzied Member
Re: Whats the syntax for R1C1 notation ?
Zaza thats exactly what I needed. It didn't even occur to me to not use a rabge object. See ... I knew asking the question would be worthwhile 
Thanks a lot 
Incidentally ... it was the omission of the square brackets as suggested by littlepd that was causing me problems late Friday afternoon.
Thanks all.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|