LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 337
Default Runtime error 1004

I can run the following code from the command button but get
"Runtime error "1004"
Application-defined or object-defined error" when I try to step thru it in
VBA at Range("J2").Select

Private Sub CommandButton1_Click() 'Print or view birthday list
Application.ScreenUpdating = False
Application.DisplayAlerts = False
'
Dim Birthdate As String

Birthdate = Range("Form!M15")
Sheets("Records").Select
Range("J2").Select
Selection.AutoFilter
Selection.AutoFilter Field:=10, Criteria1:=Birthdate, Operator:=xlAnd
Selection.Sort Key1:=Range("J3"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Range("B2:L2").Select ' Selects all filtered data
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy 'Copies filtered job data
Sheets("Birthday").Select
Range("A2").Select
ActiveSheet.Paste 'Pastes Values

Range("A1:K2").Select ' Selects all filtered data
Range(Selection, Selection.End(xlDown)).Select
'Selection.Copy 'Copies filtered job
Selection.PrintOut Copies:=1, Preview:=True, Collate:=True
Range("A2:K2").Select ' Selects all filtered data
Range(Selection, Selection.End(xlDown)).Select

Selection.Clear
Sheets("Records").Select
Selection.AutoFilter
Sheets("Form").Select ' Goes to date input screen
Range("A47").Select
Range("C47").Select
End SubI have the following code
 
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
runtime error 1004 HELP PLS Marcelo P Excel Discussion (Misc queries) 2 May 23rd 07 08:56 PM
runtime error '1004' Steve Excel Discussion (Misc queries) 1 April 28th 06 08:58 PM
Excel 2003 Macro Error - Runtime error 1004 Cow Excel Discussion (Misc queries) 2 June 7th 05 01:40 PM
runtime error 1004 monika Excel Programming 3 February 11th 04 09:48 AM
runtime error 1004 Adella Excel Programming 2 July 29th 03 08:07 PM


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