M
mathel
Hi,
I have a macro I have been using in a workbook for about 6 months with no
problem. Last week, when someone else used the same file, the macro no
longer works properly.
In short, I have a form that once completed, the macro prints certain
worksheets, copies a specific range of one worksheet, opens another file and
the copied data is to be pasted starting in Column A, 4 lines down from the
last 'used' cell.
What is happening is the macro is not finding the last cell and simply
pasting the information where ever the file was last saved. Following is a
portion of the macro in the workbook:
Application.Goto Reference:="CopyData"
Application.CutCopyMode = False
Selection.Copy
Workbooks.Open Filename:= _
"G:\WRO\"WRO Year Summery Under$10.xls"
Dim rgLastCell As Range
Set rgLastCell = ActiveSheet.Range("A65536").End(xlUp)
ActiveCell.Offset(4, 0).Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
Selection.End(xlDown).Select
Application.CutCopyMode = False
ActiveCell.Offset(4, 0).Select
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=ActiveCell
ActiveWorkbook.Save
ActiveWindow.Close
Can anyone tell me what I am doing wrong?
Thanks
I have a macro I have been using in a workbook for about 6 months with no
problem. Last week, when someone else used the same file, the macro no
longer works properly.
In short, I have a form that once completed, the macro prints certain
worksheets, copies a specific range of one worksheet, opens another file and
the copied data is to be pasted starting in Column A, 4 lines down from the
last 'used' cell.
What is happening is the macro is not finding the last cell and simply
pasting the information where ever the file was last saved. Following is a
portion of the macro in the workbook:
Application.Goto Reference:="CopyData"
Application.CutCopyMode = False
Selection.Copy
Workbooks.Open Filename:= _
"G:\WRO\"WRO Year Summery Under$10.xls"
Dim rgLastCell As Range
Set rgLastCell = ActiveSheet.Range("A65536").End(xlUp)
ActiveCell.Offset(4, 0).Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
Selection.End(xlDown).Select
Application.CutCopyMode = False
ActiveCell.Offset(4, 0).Select
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=ActiveCell
ActiveWorkbook.Save
ActiveWindow.Close
Can anyone tell me what I am doing wrong?
Thanks