View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Charles Chickering Charles Chickering is offline
external usenet poster
 
Posts: 272
Default run-time error 1004 - VBA Gurus Please Help

I gave you wrong information, you can modify another sheet from the sheet
code, however the problem is when you state Range("D2").Select from the sheet
code it thinks you mean sheets("Production").Range("D2") you need to specify
the parent object in order to fix this error.
Either:
Sheets("hours").Range("D2").Select
or:
With Sheets("hours")
.Range("D2").Select
End with

--
Charles Chickering

"A good example is twice the value of good advice."


"Charles Chickering" wrote:

I'm guessing that the code is in the "Production" sheet code area. if that is
the case then Susan is correct, you cannot select another sheet from there.
You can however create a macro in a separate module and call that macro from
your button.
--
Charles Chickering

"A good example is twice the value of good advice."


"SmartyPants" wrote:


Susan wrote:
the gurus just helped me with "select".
you can measurably shorten your code by using

Sheets("Production").Range("D4").ClearContents
(one line instead of three).

OR
With Sheets("Production")
.Range("D4").ClearContents
.Range("F4").ClearContents
'continue
End With

With xxxxxNextSheet
End With

as for why your button isn't working, where is the button located?
toolbar? activex control? userform?
susan


The button is located on the actual sheet(production).