Hi
I have some code in my workbook which basically looks for the letter Y in column I and copies that data from sheet "Julie" to the "archive" sheet.
What I would like to do is to replace the references to Sheets("Julie") and enable it to run from whatever worksheet I am running the macro from. I've tried using ActiveSheet but when the Archive is closed down it won't reselect the original worksheet.
Does anybody have any ideas how I may do that.
The code that I am currently using is
Any help appreciated
I have some code in my workbook which basically looks for the letter Y in column I and copies that data from sheet "Julie" to the "archive" sheet.
What I would like to do is to replace the references to Sheets("Julie") and enable it to run from whatever worksheet I am running the macro from. I've tried using ActiveSheet but when the Archive is closed down it won't reselect the original worksheet.
Does anybody have any ideas how I may do that.
The code that I am currently using is
HTML:
Public Sub CopyRows()
Application.ScreenUpdating = False
Sheets("Archive").Visible = True
Sheets("Julie").Select
' Find the last row of data
FinalRow = Range("A65536").End(xlUp).Row
' Loop through each row
For x = 2 To FinalRow
' Decide if to copy based on column H
ThisValue = Range("i" & x).Value
If ThisValue = "Y" Then
Range("A" & x & ":i" & x).COPY
Sheets("Archive").Select
NextRow = Range("A65536").End(xlUp).Row + 1
Range("A" & NextRow).Select
ActiveSheet.Paste
Sheets("Julie").Select
Rows(x).delete
End If
Next x
Sheets("Archive").Visible = False
Application.ScreenUpdating = True
End Sub
Any help appreciated