View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
deej deej is offline
external usenet poster
 
Posts: 3
Default runtime error '1004' application or object defined error. Please help

I'm trying to use a macro to select the first blank cell in a column
(amongst other things), but keep getting this error. Here is the code:

Sub Tfr_to_DB()
Select Case Application.MailSystem
Case xlMAPI
Dim wb As Workbook
Application.ScreenUpdating = False
ActiveSheet.Copy
Set wb = ActiveWorkbook
With wb
.SendMail "...@...", _
"Fee Book - " & Range("B1")
.Close False
End With

Case xlNoMailSystem
MsgBox "no mail client"

Case Else
Application.CommandBars("worksheet menu bar") _
.Controls("File").Controls("Send To").Controls("Mail
Recipient...").Execute

End Select

Application.ScreenUpdating = True


Range("A4:g16").Select
Selection.Copy


Worksheets("Database").Activate
Dim ws As Worksheet
Set ws = Worksheets("Database")
With ws
.Range("A1").End(xlDown).Offset(1, 0).Select
'ERROR IS HERE

Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False

Columns("A:G").Select
Application.CutCopyMode = False
Selection.Sort Key1:=Range("A2"), Order1:=xlDescending, Header:
=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Range("A1").Select

End With

Sheets("New Invoices").Select
ActiveWindow.ScrollRow = 1
Range("A4:f16").Select
Selection.ClearContents
ActiveWindow.SmallScroll Down:=-9
Range("A4").Select
End Sub

You can probably tell I'm a novice.

Any help is appreciated.

deej

--
Posted via a free Usenet account from http://www.teranews.com