View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
BLJ BLJ is offline
external usenet poster
 
Posts: 3
Default macro v active x control

Hi below is the gist

Workbooks.Open Filename:="C:\stats.xls"
Windows("stats.xls").Activate
Rows("3:3").Select
Selection.Insert Shift:=xlDown

the error occurs when it hits the "rows" . As mentioned, works fine just as
a plain macro, but not as code within a control ... which I gather is the
point I just don't know why

Bruce

Could you post your code for us

"BLJ" wrote:

Hi, bit new to excel but have been writing VBA in Access for years.

I've got two workbooks "invoice" and "stats". I've writen a macro to
take
some cell values in Invoice, open Stats and place them in various cells.
works fine as a macro. However if I put the code in a control button
(click
to run) then it comes up with a 1004 error. played around making sure it
was activated etc but always failed.

The work around was to make clicking the button merely run the macro - so
it's no big deal but can anyone explain why this happens (any why it's
not
relevant in Access)

thanks
bruce