ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Application defined error (https://www.excelbanter.com/excel-programming/330190-application-defined-error.html)

Larry

Application defined error
 
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("F ield 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!

Alok

Application defined error
 
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

"Larry" wrote:

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("F ield 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!


Larry

Application defined error
 
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.

"Alok" wrote:

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

"Larry" wrote:

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("F ield 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!


Alok

Application defined error
 
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

"Larry" wrote:

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.

"Alok" wrote:

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

"Larry" wrote:

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("F ield 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!


Larry

Application defined error
 
Found it! Thanks!

"Alok" wrote:

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

"Larry" wrote:

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.

"Alok" wrote:

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

"Larry" wrote:

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("F ield 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!



All times are GMT +1. The time now is 10:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com