hi can you please help me with this code keep getting the error "object variable or with variable not set"
many thanks
Sub test() Dim fname As String Dim fpath As String Dim owb As Workbook fname = "DummyXXAC.xlsm" fpath = "C:\Users\USER\Desktop" owb = Application.Workbooks.Open(fpath & "\" & fname) Windows("CNAV.xlsm").Activate Set rngcopy = Sheets("Raw data").Range("A1:IV1").Find("Ccy", LookIn:=xlValues) Set rngcopy = Range(rngcopy.Offset(1, 0), Cells(Rows.Count, rngcopy.Column).End(xlUp)) Set rngPaste = Workbooks(DummyXXAC.xlsm).Sheets("Sheet1").Range("d2") rngcopy.Copy rngPaste.PasteSpecial xlPasteValues rngPaste.PasteSpecial xlPasteFormats End Sub




Reply With Quote