View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
markx markx is offline
external usenet poster
 
Posts: 60
Default Copy/paste macro blocking

Dear All,

I prepared a code that should:
- copy last used line from currently used workbook
- paste it to the first free line on all other opened workbooks

For some reason, the code blocks on the line:
FirstFreeRow = Range("B7").End(xlDown + 1).Row


Can you tell me what should I modify?
Thanks a lot,
Mark
-----------------
Here's the code:

Sub Macro7()

Dim wbk As Workbook

lastDataRow = Range("B7").End(xlDown).Row
Range("B" & lastDataRow).Select
Range(ActiveCell, ActiveCell.Offset(0, 9)).Select
Selection.Copy

'it would be also useful to exclude the file we just used, but at the end I
can also live without it (=delete the double row manually after the macro is
executed)
For Each wbk In Application.Workbooks
wbk.Activate
Worksheets("Sheet1").Activate
FirstFreeRow = Range("B7").End(xlDown + 1).Row
Range("B" & FirstFreeRow).Select
Selection.Paste
Next wbk

End Sub