Hi all,
I have this code that copies data from A1 down to J1 and down where the cells in column C (3) is not empty.
Now i wanna use this in my project but the data that needs to be copied is in a protected worksheet named Shifts2019 which is placed somewhere on the disk P:
How do i change my code that the source is a protected workfile somewhere else?
The protected file is opened with read only.
I started with this but got stuck;
I have this code that copies data from A1 down to J1 and down where the cells in column C (3) is not empty.
Code:
Sub FilterData()
ActiveSheet.AutoFilterMode = False
Range("J1:Q" & Range("J" & Rows.Count).End(xlUp).Row).ClearContents
Range("A1").AutoFilter Field:=2, Criteria1:="<>"
ActiveSheet.AutoFilter.Range.Copy
Range("J1").PasteSpecial xlPasteAll
Application.CutCopyMode = False
ActiveSheet.AutoFilterMode = False
End Sub
Now i wanna use this in my project but the data that needs to be copied is in a protected worksheet named Shifts2019 which is placed somewhere on the disk P:
How do i change my code that the source is a protected workfile somewhere else?
The protected file is opened with read only.
I started with this but got stuck;
Code:
Sub FilterData()
ActiveSheet.AutoFilterMode = False
Sheets("Shifts").Range("A1:H" & Range("A" & Rows.Count).End(xlUp).Row).ClearContents
'in this line it should point to the protected file?
Range("A1").AutoFilter Field:=2, Criteria1:="<>"
ActiveSheet.AutoFilter.Range.Copy
Range("A1").PasteSpecial xlPasteAll
Application.CutCopyMode = False
ActiveSheet.AutoFilterMode = False
End Sub
Last edited: