Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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! |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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! |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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! |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Run-time error '50290': Application-defined or object-defined erro | Excel Discussion (Misc queries) | |||
Macro error : Application-defined or object-defined error | Excel Discussion (Misc queries) | |||
Macro Run-time Error 1004 Application Defined or Object Defined Error | Excel Programming | |||
Runtime Error 1004 -- Application Defined or Object Defined Error | Excel Programming |