Application defined error

G

Guest

I have a macro to copy info from one sheet and paste it into selected blank
cells on another sheet. It should work, but the application error indicates
there's something wrong with: Worksheets("Field Activity
Report").Cells(BlankCell,4).Select

Here's the macro:
Sub CopyRetailerInfo()
Dim BlankCell As Integer

Range(ActiveCell, ActiveCell.Offset(0, 4)).Copy
Worksheets("Field Activity Report").Select
BlankCell = Application.WorksheetFunction.CountA(Worksheets("Field Activity
Report").Range("D:D")) = 1
Worksheets("Field Activity Report").Cells(BlankCell, 4).Select
Selection.PasteSpecial (xlPasteValues)
Application.CutCopyMode = False
Worksheets("Survey Spreadsheet").Select

End Sub

Any guidance would certainly be appreciated. Thanks!
 
G

Guest

You have not explained the actual error you are getting. However, add the
following line before the line you are getting the error in and it might work.

Worksheets("Field Activity Report").Activate

Alok Joshi
 
G

Guest

The popup box reads: Run-time error '1004'. Application-defined or
object-defined error. When I click on 'debug' , that one line is
highlighted. Thanks.
 
G

Guest

This error will happen when BlankCell variable has a value of 0 as you are
then accessing a cell in row 0. This will happen if there is nothing in the
D:D range. Just check why that is happening.

Alok Joshi
 
G

Guest

Found it! Thanks!

Alok said:
This error will happen when BlankCell variable has a value of 0 as you are
then accessing a cell in row 0. This will happen if there is nothing in the
D:D range. Just check why that is happening.

Alok Joshi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top