Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default cell reference in formula

I had a similar problem in a post earlier today, here's the solution
was given...and it worked.

Seems simple enough but I cannot find any help on the matter...

I cannot get the required syntax to allow me to use a variable, "i"
within the formula, "=RC[-1]&""/""&RC[&i]"

Sub Macro1()
Dim i As Integer
i = 2

Range("D2").Select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = "=RC[-1]&""/""&RC[&i]"
ActiveCell.Offset(0, 1).Select
i = -2 + i
Loop
End Sub

Column headings exist in every other column along row 2. I want th
formula to pick up the heading in C2 every time, add a division sig
and then add the heading from the preceding column.

For example if C2's heading reads "Animal", D2's heading reads "Plant
and F2's heading reads "Fungi". In this example I want the formula t
print "Animal/Plant" in E2 and "Animal/Fungi" in G2.

Thanks for any help!

Ryan

I was told to use this line and met with success...
ActiveCell.FormulaR1C1 = "=RC[" & i & "]" & Chr(38) & Chr(34)
"/" & Chr(34) & Chr(38) & "RC[-1]"

Good luck

--
Message posted from http://www.ExcelForum.com

Reply
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
format a cell with a formula so an empty reference cell shows blan M2 Excel Discussion (Misc queries) 3 November 7th 06 10:42 PM
Using a cell reference within a cell reference in a formula david Excel Worksheet Functions 2 July 1st 06 01:05 PM
How do I leave formula cell blank if 2nd reference cell is empty? Liana S Excel Discussion (Misc queries) 2 October 21st 05 04:38 PM
Cell Formula reference to cell Based On third Cell Content Gabriel Excel Discussion (Misc queries) 1 February 11th 05 06:36 AM
Cell Formula reference to cell Based On third Cell Content Gabriel Excel Discussion (Misc queries) 0 February 11th 05 05:35 AM


All times are GMT +1. The time now is 11:20 AM.

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"