Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Cannot Paste formula to cells via VB

I am trying to link several cells on different worksheets
to one single cell using a Subroutine. It works for a
couple of links but when there is more then about 10 links
the Subroutine won't paste it into the cell and it errors
with "Error 1004, Application defined or Object defined
error". any help?

PS this is the problematic Code.

MyString = Cells(Row, Col).Formula
MyString = Replace(MyString, SheetName1, "") 'Remove
missing link
MyString = Replace(MyString, "++", "+")
MyString = Replace(MyString, "=+", "=")
If MyString = "=" Then MyString = ""
Cells(Row, Col).Formula = MyString
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Cannot Paste formula to cells via VB

I suspect you are producing an invalid formula with your manipulations and
that is causing an error. Doing one formula at a time would not cause an
error, even if you were looping over many cells.

Think you need to do a

debug.print myString
Cells(Row, Col).Formula = MyString

then if you get the error, look in the immediate window to see what the
formula looks like. (or go to debug and hover the mouse over the mystring
variable or do ? mystring in the immediate window.

--
Regards,
Tom Ogilvy



"Owen" wrote in message
...
I am trying to link several cells on different worksheets
to one single cell using a Subroutine. It works for a
couple of links but when there is more then about 10 links
the Subroutine won't paste it into the cell and it errors
with "Error 1004, Application defined or Object defined
error". any help?

PS this is the problematic Code.

MyString = Cells(Row, Col).Formula
MyString = Replace(MyString, SheetName1, "") 'Remove
missing link
MyString = Replace(MyString, "++", "+")
MyString = Replace(MyString, "=+", "=")
If MyString = "=" Then MyString = ""
Cells(Row, Col).Formula = MyString



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Cannot Paste formula to cells via VB

I Have tried that and the formula is valid. I also wrote
it in manually into the cell and that worked. however it
still errors when I try to paste large Formulas.

-----Original Message-----
I suspect you are producing an invalid formula with your

manipulations and
that is causing an error. Doing one formula at a time

would not cause an
error, even if you were looping over many cells.

Think you need to do a

debug.print myString
Cells(Row, Col).Formula = MyString

then if you get the error, look in the immediate window

to see what the
formula looks like. (or go to debug and hover the mouse

over the mystring
variable or do ? mystring in the immediate window.

--
Regards,
Tom Ogilvy



"Owen" wrote in message
...
I am trying to link several cells on different

worksheets
to one single cell using a Subroutine. It works for a
couple of links but when there is more then about 10

links
the Subroutine won't paste it into the cell and it

errors
with "Error 1004, Application defined or Object defined
error". any help?

PS this is the problematic Code.

MyString = Cells(Row, Col).Formula
MyString = Replace(MyString,

SheetName1, "") 'Remove
missing link
MyString = Replace(MyString, "++", "+")
MyString = Replace(MyString, "=+", "=")
If MyString = "=" Then MyString = ""
Cells(Row, Col).Formula = MyString



.

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
how copy formula and only paste into 20,000 cells dlb1228 Excel Discussion (Misc queries) 1 February 28th 07 09:30 PM
Unable to paste a formula into other cells rjr Excel Worksheet Functions 2 April 16th 06 09:54 PM
Copy/Paste how to avoid the copy of formula cells w/o calc values Dennis Excel Discussion (Misc queries) 10 March 2nd 06 10:47 PM
quick way to copy-paste a formula linked to cells in another file iniakupake Excel Worksheet Functions 2 September 26th 05 03:56 AM
How to copy and paste same formula in multiple cells? Amanda Excel Worksheet Functions 1 June 30th 05 04:16 PM


All times are GMT +1. The time now is 06:24 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"