Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
' given weekOffset = 1
Range("B2").Select ActiveCell.FormulaR1C1 = "=A2+" & weekOffset ' produces a formula in excel as: ' ='A2'+1 ' i was expecting something like: =A2+1 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I noticed a formula in the CONCATENATE() function uses RC[index] reference.
I gave it a shot and it worked. I don't know what RC[] means, is this a safe solution? ActiveCell.FormulaR1C1 = "=RC[-1]+" & weekOffset "Amil" wrote: ' given weekOffset = 1 Range("B2").Select ActiveCell.FormulaR1C1 = "=A2+" & weekOffset ' produces a formula in excel as: ' ='A2'+1 ' i was expecting something like: =A2+1 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Amil,
R1C1 notation uses row and column numers instead of A1 which uses Alpha-numeric references an "R" or "C" without a number refers to "this row" or "this column" absolute numbers after R or C refer to absolute referferences line R1C1 = $A$1 numbers in brackets [ ] after R or C are relative references to the active cell (or the cell containing the formula. If cell C5 = A1 + B1 than in R1C1 it would be R5C3 = R[-4]C[-2] + R[-4]C[-2] Because R1C1 methods use numbers - it is easier to use variables in code to define formulas, ranges, etc. -- steveB Remove "AYN" from email to respond "Amil" wrote in message ... I noticed a formula in the CONCATENATE() function uses RC[index] reference. I gave it a shot and it worked. I don't know what RC[] means, is this a safe solution? ActiveCell.FormulaR1C1 = "=RC[-1]+" & weekOffset "Amil" wrote: ' given weekOffset = 1 Range("B2").Select ActiveCell.FormulaR1C1 = "=A2+" & weekOffset ' produces a formula in excel as: ' ='A2'+1 ' i was expecting something like: =A2+1 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You've just given me a lesson on a very important concept in VBA! I do VBA
stuff but usually just rely on macros. Very good input. "STEVE BELL" wrote: Amil, R1C1 notation uses row and column numers instead of A1 which uses Alpha-numeric references an "R" or "C" without a number refers to "this row" or "this column" absolute numbers after R or C refer to absolute referferences line R1C1 = $A$1 numbers in brackets [ ] after R or C are relative references to the active cell (or the cell containing the formula. If cell C5 = A1 + B1 than in R1C1 it would be R5C3 = R[-4]C[-2] + R[-4]C[-2] Because R1C1 methods use numbers - it is easier to use variables in code to define formulas, ranges, etc. -- steveB Remove "AYN" from email to respond "Amil" wrote in message ... I noticed a formula in the CONCATENATE() function uses RC[index] reference. I gave it a shot and it worked. I don't know what RC[] means, is this a safe solution? ActiveCell.FormulaR1C1 = "=RC[-1]+" & weekOffset "Amil" wrote: ' given weekOffset = 1 Range("B2").Select ActiveCell.FormulaR1C1 = "=A2+" & weekOffset ' produces a formula in excel as: ' ='A2'+1 ' i was expecting something like: =A2+1 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Amil,
You're Welcome... Keep on Exceling... -- steveB Remove "AYN" from email to respond "Amil" wrote in message ... You've just given me a lesson on a very important concept in VBA! I do VBA stuff but usually just rely on macros. Very good input. "STEVE BELL" wrote: Amil, R1C1 notation uses row and column numers instead of A1 which uses Alpha-numeric references an "R" or "C" without a number refers to "this row" or "this column" absolute numbers after R or C refer to absolute referferences line R1C1 = $A$1 numbers in brackets [ ] after R or C are relative references to the active cell (or the cell containing the formula. If cell C5 = A1 + B1 than in R1C1 it would be R5C3 = R[-4]C[-2] + R[-4]C[-2] Because R1C1 methods use numbers - it is easier to use variables in code to define formulas, ranges, etc. -- steveB Remove "AYN" from email to respond "Amil" wrote in message ... I noticed a formula in the CONCATENATE() function uses RC[index] reference. I gave it a shot and it worked. I don't know what RC[] means, is this a safe solution? ActiveCell.FormulaR1C1 = "=RC[-1]+" & weekOffset "Amil" wrote: ' given weekOffset = 1 Range("B2").Select ActiveCell.FormulaR1C1 = "=A2+" & weekOffset ' produces a formula in excel as: ' ='A2'+1 ' i was expecting something like: =A2+1 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You original problem is easily corrected by using the correct syntax:
' given weekOffset = 1 Range("B2").Select ActiveCell.Formula = "=A2+" & weekOffset When using Formula us A1 notation. When using FormulaR1C1 use R1C1 notation. -- Regards, Tom Ogilvy "Amil" wrote in message ... You've just given me a lesson on a very important concept in VBA! I do VBA stuff but usually just rely on macros. Very good input. "STEVE BELL" wrote: Amil, R1C1 notation uses row and column numers instead of A1 which uses Alpha-numeric references an "R" or "C" without a number refers to "this row" or "this column" absolute numbers after R or C refer to absolute referferences line R1C1 = $A$1 numbers in brackets [ ] after R or C are relative references to the active cell (or the cell containing the formula. If cell C5 = A1 + B1 than in R1C1 it would be R5C3 = R[-4]C[-2] + R[-4]C[-2] Because R1C1 methods use numbers - it is easier to use variables in code to define formulas, ranges, etc. -- steveB Remove "AYN" from email to respond "Amil" wrote in message ... I noticed a formula in the CONCATENATE() function uses RC[index] reference. I gave it a shot and it worked. I don't know what RC[] means, is this a safe solution? ActiveCell.FormulaR1C1 = "=RC[-1]+" & weekOffset "Amil" wrote: ' given weekOffset = 1 Range("B2").Select ActiveCell.FormulaR1C1 = "=A2+" & weekOffset ' produces a formula in excel as: ' ='A2'+1 ' i was expecting something like: =A2+1 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Drag Down Formula Incorrect | Excel Worksheet Functions | |||
incorrect output of if formula | Excel Discussion (Misc queries) | |||
Formula incorrect answer | Excel Discussion (Misc queries) | |||
Getting Incorrect Calculation From Formula | Excel Worksheet Functions | |||
formula result incorrect | Excel Discussion (Misc queries) |