Thread: cells function
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JW[_2_] JW[_2_] is offline
external usenet poster
 
Posts: 638
Default cells function

On May 19, 10:11*am, Raul Sousa
wrote:
The resulto of the code
* * ActiveCell.Formula = "=" & (Cells(11, Sheets.Count + 1))
*is : =
But, I need it to be equal to :
*= D11, or E11, depending on the number of sheets
What am I doing wrong?


Right now, you are basically saying that you want the formula to equal
the value of that cell. What you need it to do is equal the address
of that cell.

For absolute references, use
ActiveCell.Formula = "=" & Cells(11, Sheets.Count + 1).Address

Or use this if you do not want absolute references
ActiveCell.Formula = "=" & Cells(11, Sheets.Count + 1).Address(False,
False)