Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default ActiveCell.FormulaR1C1 = "=RC[-4]-RC[-2]"

If I exectue this simple code :

Range("F8").Select
ActiveCell.FormulaR1C1 = "=RC[-4]-RC[-2]"

It works great if I execute if from the current workbook but if the code is
in another workbook and I include:
Windows("Libro1").Activate

It raises error 1004

Any help?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default ActiveCell.FormulaR1C1 = "=RC[-4]-RC[-2]"

Hello Jordi,

Check if the sheet that get the entry is not protected (Tools|Protection).
If it is protected you may want to include this into your code before the
entry

Activesheet.Unprotect
....you code here
Activesheet.Protect

If it is has password you need to type the password after the "Unprotect"
and "Protect".

Regards,

Jon-jon

"Jordi" wrote in message
...
If I exectue this simple code :

Range("F8").Select
ActiveCell.FormulaR1C1 = "=RC[-4]-RC[-2]"

It works great if I execute if from the current workbook but if the code

is
in another workbook and I include:
Windows("Libro1").Activate

It raises error 1004

Any help?




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default ActiveCell.FormulaR1C1 = "=RC[-4]-RC[-2]"

Isn't the case
but thank you.
Any other idea?

"JON JON" escribió en el mensaje
...
Hello Jordi,

Check if the sheet that get the entry is not protected (Tools|Protection).
If it is protected you may want to include this into your code before the
entry

Activesheet.Unprotect
...you code here
Activesheet.Protect

If it is has password you need to type the password after the "Unprotect"
and "Protect".

Regards,

Jon-jon

"Jordi" wrote in message
...
If I exectue this simple code :

Range("F8").Select
ActiveCell.FormulaR1C1 = "=RC[-4]-RC[-2]"

It works great if I execute if from the current workbook but if the code

is
in another workbook and I include:
Windows("Libro1").Activate

It raises error 1004

Any help?






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default ActiveCell.FormulaR1C1 = "=RC[-4]-RC[-2]"

I am trying to duplicate your scenario but could not get the same error.
Have you tried to debug? Where does the highlight go? I am suspecting that
it has something to do with the activate and select command. You may want
to avoid that and instead try something like

Workbooks("Book1").Sheets("Sheet1").Range("F8").Fo rmulaR1C1 =
"=RC[-4]-RC[-2]"


"Jordi" wrote in message
...
Isn't the case
but thank you.
Any other idea?

"JON JON" escribió en el mensaje
...
Hello Jordi,

Check if the sheet that get the entry is not protected

(Tools|Protection).
If it is protected you may want to include this into your code before

the
entry

Activesheet.Unprotect
...you code here
Activesheet.Protect

If it is has password you need to type the password after the

"Unprotect"
and "Protect".

Regards,

Jon-jon

"Jordi" wrote in message
...
If I exectue this simple code :

Range("F8").Select
ActiveCell.FormulaR1C1 = "=RC[-4]-RC[-2]"

It works great if I execute if from the current workbook but if the

code
is
in another workbook and I include:
Windows("Libro1").Activate

It raises error 1004

Any help?








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default ActiveCell.FormulaR1C1 = "=RC[-4]-RC[-2]"

I try both "Book1" and "Book1.xls" they will both work if the file is save
for the first time. However, if it is a new workbook, "Book1.xls" give me
subscript out range error.


"Don Guillett" wrote in message
...
try is with "book1.xls" assuming that it is OPEN.

--
Don Guillett
SalesAid Software

"JON JON" wrote in message
...
I am trying to duplicate your scenario but could not get the same error.
Have you tried to debug? Where does the highlight go? I am suspecting

that
it has something to do with the activate and select command. You may

want
to avoid that and instead try something like

Workbooks("Book1").Sheets("Sheet1").Range("F8").Fo rmulaR1C1 =
"=RC[-4]-RC[-2]"


"Jordi" wrote in message
...
Isn't the case
but thank you.
Any other idea?

"JON JON" escribió en el mensaje
...
Hello Jordi,

Check if the sheet that get the entry is not protected

(Tools|Protection).
If it is protected you may want to include this into your code

before
the
entry

Activesheet.Unprotect
...you code here
Activesheet.Protect

If it is has password you need to type the password after the

"Unprotect"
and "Protect".

Regards,

Jon-jon

"Jordi" wrote in message
...
If I exectue this simple code :

Range("F8").Select
ActiveCell.FormulaR1C1 = "=RC[-4]-RC[-2]"

It works great if I execute if from the current workbook but if

the
code
is
in another workbook and I include:
Windows("Libro1").Activate

It raises error 1004

Any help?












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
ActiveCell.FormulaR1C1 Rick Excel Discussion (Misc queries) 3 March 28th 10 10:36 PM
ActiveCell.FormulaR1C1 = "=SUM(R[-tellerteller]C:R[-1]C)" Jack Sons Excel Discussion (Misc queries) 5 September 29th 09 09:58 PM
Whats wrong with this VBA statement -ActiveCell.FormulaR1C1...? hal Excel Programming 5 November 8th 03 02:48 AM
ActiveCell.FormulaR1C1 Leif Rasmussen Excel Programming 1 October 16th 03 09:46 AM
XP VBA: Range("A2", ActiveCell.SpecialCells(xlLastCell)).Select wessman Excel Programming 2 July 23rd 03 06:33 PM


All times are GMT +1. The time now is 05:49 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"