ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro Debug Error (https://www.excelbanter.com/excel-discussion-misc-queries/148038-macro-debug-error.html)

Soroya1920

Macro Debug Error
 
I have a "database" worksheet with 7 columns that input information on one
row at a time. I then have a second worksheet "request form" that I have my
macro button on that extracts the information into a form type format from
the last line of the "database" worksheet. I've been able to extract rows 1-4
but I get a debug error at the first 'ActiveSheet.Paste' when extracting info
from row 5. I've cleared the formatting and deleted that specific row. What
am I doing wrong?

Sheets("data base of requests").Select
Range("A1").Select
Selection.End(xlDown).Select
Selection.Copy
Sheets("request form").Select
Range("g10").Select
ActiveSheet.Paste
Sheets("data base of requests").Select
ActiveCell.Offset(-2, 1).Range("A1").Select
Selection.End(xlDown).Select
Application.CutCopyMode = False
Selection.Copy
Sheets("request form").Select
Range("b12").Select
ActiveSheet.Paste
Sheets("data base of requests").Select
ActiveCell.Offset(-2, 1).Range("A1").Select
Selection.End(xlDown).Select
Application.CutCopyMode = False
Selection.Copy
Sheets("request form").Select
Range("G12").Select
ActiveSheet.Paste
Sheets("data base of requests").Select
ActiveCell.Offset(-2, 1).Range("A1").Select
Selection.End(xlDown).Select
Application.CutCopyMode = False
Selection.Copy
Sheets("request form").Select
Range("B8").Select
ActiveSheet.Paste
Sheets("data base of requests").Select
ActiveCell.Offset(-2, 1).Range("A1").Select
Selection.End(xlDown).Select
Application.CutCopyMode = False
Selection.Copy
Sheets("request form").Select
Range("G8").Select
ActiveSheet.Paste
Sheets("data base of requests").Select
ActiveCell.Offset(-2, 1).Range("A1").Select
Selection.End(xlDown).Select
Application.CutCopyMode = False
Selection.Copy
Sheets("request form").Select
Range("B10").Select
ActiveSheet.Paste
Sheets("data base of requests").Select
ActiveCell.Offset(-2, 1).Range("A1").Select
Selection.End(xlDown).Select
Application.CutCopyMode = False
Selection.Copy
Sheets("request form").Select
Range("B14").Select
ActiveSheet.Paste
Sheets("data base of requests").Select
ActiveCell.Offset(-2, 1).Range("A1").Select
Selection.End(xlDown).Select
Application.CutCopyMode = False
Selection.Copy
Sheets("request form").Select
Range("B16").Select
ActiveSheet.Paste
Sheets("data base of requests").Select
ActiveCell.Offset(-2, 1).Range("A1").Select
Selection.End(xlDown).Select
Application.CutCopyMode = False
Selection.Copy
Sheets("request form").Select
Range("B17").Select
ActiveSheet.Paste
Sheets("data base of requests").Select
ActiveCell.Offset(-2, 1).Range("A1").Select
Selection.End(xlDown).Select
Application.CutCopyMode = False
Selection.Copy
Sheets("request form").Select
Range("B18").Select
ActiveSheet.Paste
End Sub


Trevor Shuttleworth

Macro Debug Error
 
I think it must depend on what data you have in what cells.

It works fine for me but I probably haven't got my test data set up like
yours

What error do you get ? Have you stepped it through and watched where it
fails and what the data looks like at that point ?

Does this make your head ache when it runs ? ;-)

Regards

Trevor


"Soroya1920" wrote in message
...
I have a "database" worksheet with 7 columns that input information on one
row at a time. I then have a second worksheet "request form" that I have
my
macro button on that extracts the information into a form type format from
the last line of the "database" worksheet. I've been able to extract rows
1-4
but I get a debug error at the first 'ActiveSheet.Paste' when extracting
info
from row 5. I've cleared the formatting and deleted that specific row.
What
am I doing wrong?

Sheets("data base of requests").Select
Range("A1").Select
Selection.End(xlDown).Select
Selection.Copy
Sheets("request form").Select
Range("g10").Select
ActiveSheet.Paste
Sheets("data base of requests").Select
ActiveCell.Offset(-2, 1).Range("A1").Select
Selection.End(xlDown).Select
Application.CutCopyMode = False
Selection.Copy
Sheets("request form").Select
Range("b12").Select
ActiveSheet.Paste
Sheets("data base of requests").Select
ActiveCell.Offset(-2, 1).Range("A1").Select
Selection.End(xlDown).Select
Application.CutCopyMode = False
Selection.Copy
Sheets("request form").Select
Range("G12").Select
ActiveSheet.Paste
Sheets("data base of requests").Select
ActiveCell.Offset(-2, 1).Range("A1").Select
Selection.End(xlDown).Select
Application.CutCopyMode = False
Selection.Copy
Sheets("request form").Select
Range("B8").Select
ActiveSheet.Paste
Sheets("data base of requests").Select
ActiveCell.Offset(-2, 1).Range("A1").Select
Selection.End(xlDown).Select
Application.CutCopyMode = False
Selection.Copy
Sheets("request form").Select
Range("G8").Select
ActiveSheet.Paste
Sheets("data base of requests").Select
ActiveCell.Offset(-2, 1).Range("A1").Select
Selection.End(xlDown).Select
Application.CutCopyMode = False
Selection.Copy
Sheets("request form").Select
Range("B10").Select
ActiveSheet.Paste
Sheets("data base of requests").Select
ActiveCell.Offset(-2, 1).Range("A1").Select
Selection.End(xlDown).Select
Application.CutCopyMode = False
Selection.Copy
Sheets("request form").Select
Range("B14").Select
ActiveSheet.Paste
Sheets("data base of requests").Select
ActiveCell.Offset(-2, 1).Range("A1").Select
Selection.End(xlDown).Select
Application.CutCopyMode = False
Selection.Copy
Sheets("request form").Select
Range("B16").Select
ActiveSheet.Paste
Sheets("data base of requests").Select
ActiveCell.Offset(-2, 1).Range("A1").Select
Selection.End(xlDown).Select
Application.CutCopyMode = False
Selection.Copy
Sheets("request form").Select
Range("B17").Select
ActiveSheet.Paste
Sheets("data base of requests").Select
ActiveCell.Offset(-2, 1).Range("A1").Select
Selection.End(xlDown).Select
Application.CutCopyMode = False
Selection.Copy
Sheets("request form").Select
Range("B18").Select
ActiveSheet.Paste
End Sub





All times are GMT +1. The time now is 04:46 PM.

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