LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Incorrect formula created

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






 
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
Drag Down Formula Incorrect Disco3Stu Excel Worksheet Functions 3 March 9th 10 10:35 AM
incorrect output of if formula Seeker Excel Discussion (Misc queries) 6 July 1st 09 04:33 AM
Formula incorrect answer Wanna Learn Excel Discussion (Misc queries) 3 February 19th 07 04:29 PM
Getting Incorrect Calculation From Formula Don Excel Worksheet Functions 1 December 3rd 06 04:56 AM
formula result incorrect Micayla Bergen Excel Discussion (Misc queries) 2 June 6th 05 03:52 AM


All times are GMT +1. The time now is 10:08 PM.

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"