View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tim Williams Tim Williams is offline
external usenet poster
 
Posts: 1,588
Default Syntax for a formulae in Visual Basic


ActiveCell.FormulaR1C1 = "=RC[" & i & "] & ""_"" & RC[" & j & "]"

should work

Tim

"Highlystrung" wrote in message
...
I'm trying to put a formulae into a spreadsheet in a program as thus:

"=RC[6] & ""_"" & RC[7]"

This works fine but I'd like to replace the numbers giving the columns
with
variables i and j. I can't seem to get a syntax sorted that doesn't fall
over. Can anyone help?

Here's one variant that I tried: ActiveCell.FormulaR1C1 = "=RC[" & i & "]"
&
"_" & "RC[" & j & "]" where i and j are variables. Clearly not doing
something right! Any help greatly appreciated,
--
thanks, Neil