Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Your question is not entirely clear to me. Are you looking for this?
ActiveCell.Formula = "=" & Chr(65 + Sheets.Count) & "11" Rick "Raul Sousa" wrote in message ... 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? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
A formula has to look lie it would on a worksheet such as "=D11"
You can modify your code like this ActiveCell.Formula = "=" & (Cells(11, Sheets.Count + 1).address) or ActiveCell.Formula = "=K" & (Sheets.Count + 1) "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? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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) |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On May 19, 10:29*am, Joel wrote:
A formula has to look lie it would on a worksheet such as "=D11" You can modify your code like this ActiveCell.Formula = "=" & (Cells(11, Sheets.Count + 1).address) or ActiveCell.Formula = "=K" & (Sheets.Count + 1) "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?- Hide quoted text - - Show quoted text - Joel, that last option wouldn't work. The "11" in the Cells function is refering to the row number, not the column number. |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Raul,
The problem is the "formula" is only taken the "=" symbol and not the reference to the "Cells(11....." because "Cells(11...." represents a value, for example, watch my lines and this it works. Sub prueba() aux = "B1" Range("A1").Formula = "=" & aux End Sub yo just need to find a way to transform the "Cells(11...." to a text string it represents the cell you are referencing for... if i find a way i will let you know... |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you.
It was very clear. I need to use. adress if I need the cell's adress. "JW" wrote: 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) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Hyperlink function and copy the cells without the function | Excel Programming | |||
How do I create an IF function to hide cells in column B IF cells. | Excel Programming | |||
How do I create an IF function to hide cells in column B IF cells. | Excel Programming | |||
How do I create an IF function to hide cells in column B IF cells. | Excel Programming | |||
Creating a Function that references cells to other cells... | Excel Programming |