Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Does anyone know why I get an error when I try to write this formula to a cell?
Range("A2").formula = "='LP-A'!E10" where LP-A is the name of a sheet and E10 is the cell whose value that I want to put in A2 I get a trappable error 1004 description is "Application - defined or object-defined error" Any help would be greatly appreciated! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I can't replicate your error in Excel 2002.
-- Vasant "Bobby Renfro" <Bobby wrote in message ... Does anyone know why I get an error when I try to write this formula to a cell? Range("A2").formula = "='LP-A'!E10" where LP-A is the name of a sheet and E10 is the cell whose value that I want to put in A2 I get a trappable error 1004 description is "Application - defined or object-defined error" Any help would be greatly appreciated! |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I can't replicate your results - do you have the worksheet protected?
In article , Bobby Renfro <Bobby wrote: Does anyone know why I get an error when I try to write this formula to a cell? Range("A2").formula = "='LP-A'!E10" where LP-A is the name of a sheet and E10 is the cell whose value that I want to put in A2 I get a trappable error 1004 description is "Application - defined or object-defined error" Any help would be greatly appreciated! |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You sure that the name of that worksheet is LP-A?
Maybe extra (leading/trailing/embedded spaces)??? Maybe that worksheet doesn't exist in the activeworkbook. Bobby Renfro wrote: Does anyone know why I get an error when I try to write this formula to a cell? Range("A2").formula = "='LP-A'!E10" where LP-A is the name of a sheet and E10 is the cell whose value that I want to put in A2 I get a trappable error 1004 description is "Application - defined or object-defined error" Any help would be greatly appreciated! -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
LP-A is the name of the sheet, and the worksheet is not protected. The
strange thing is that I can record a macro that executes when I push a button. This macro correctly inserts the formula in the cell, but when my code wants to put the formula in the cell using the same code as the formula I get the error. I can't figure it out. "Dave Peterson" wrote: You sure that the name of that worksheet is LP-A? Maybe extra (leading/trailing/embedded spaces)??? Maybe that worksheet doesn't exist in the activeworkbook. Bobby Renfro wrote: Does anyone know why I get an error when I try to write this formula to a cell? Range("A2").formula = "='LP-A'!E10" where LP-A is the name of a sheet and E10 is the cell whose value that I want to put in A2 I get a trappable error 1004 description is "Application - defined or object-defined error" Any help would be greatly appreciated! -- Dave Peterson |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Are you using xl97?
Are you running this code from a commandbutton from the control toolbox toolbar placed on a worksheet? (Or any control from that control toolbox toolbar?) If yes, try changing the .takefocusonclick property for that button to False. If the control doesn't have that property, try adding: activecell.activate to the top of the code. (This was a bug that was fixed in xl2k.) Bobby Renfro wrote: LP-A is the name of the sheet, and the worksheet is not protected. The strange thing is that I can record a macro that executes when I push a button. This macro correctly inserts the formula in the cell, but when my code wants to put the formula in the cell using the same code as the formula I get the error. I can't figure it out. "Dave Peterson" wrote: You sure that the name of that worksheet is LP-A? Maybe extra (leading/trailing/embedded spaces)??? Maybe that worksheet doesn't exist in the activeworkbook. Bobby Renfro wrote: Does anyone know why I get an error when I try to write this formula to a cell? Range("A2").formula = "='LP-A'!E10" where LP-A is the name of a sheet and E10 is the cell whose value that I want to put in A2 I get a trappable error 1004 description is "Application - defined or object-defined error" Any help would be greatly appreciated! -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Need help writing a formula | Excel Discussion (Misc queries) | |||
writing a formula | Excel Worksheet Functions | |||
Relative/Absolute Formula writing in to a cell. | Excel Programming | |||
Writing Excel Formula To A Cell | Excel Programming | |||
Writing a formula into a cell | Excel Programming |