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

Im trying to put a formulae into a spreadsheet in a program as thus:

ActiveCell.FormulaR1C1 = "=RC[6] & ""_"" & RC[7]"

This works fine but Id like to replace the numbers giving the columns with
variables i and j. I cant seem to get a syntax sorted that doesnt 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