Hello i am getting a run time error 424 object required
the error is happening at the part of the code where i put a ->
What my code is trying to do is copy and paste values from that range set in the code. The code before that, i have other code that has the user select the copy file and the paste file. The file path text is then put into a cell, the copy one is on d5 and paste one is d7
so instead of doing filepathopen since i have this in different modules i figured that if i had the text of the file path somewhere i can reference it and then use it in all modules and the filepathopen code is only used once where the user selects the copy and paste files
is there a way to fix/edit my code so this error doesnt happen and that it can use that file path text and just do to the sheet asked in that case "Sch C" copy the range then paste it into the other file pastes sch c range?
thank you!
code:
Sub Get_data()
Application.ScreenUpdating = False
copy_wb = ThisWorkbook.Worksheets("File Paths").Range("D5").Value
paste_wb = ThisWorkbook.Worksheets("File Paths").Range("d7").Value
-> copy_wb.Worksheets("Sch C").Range("f12:f13").Copy
paste_wb.Worksheets("Sch C").Range("E11:E12").Offset(, myvalC).PasteSpecial Paste:=xlPasteValues
the error is happening at the part of the code where i put a ->
What my code is trying to do is copy and paste values from that range set in the code. The code before that, i have other code that has the user select the copy file and the paste file. The file path text is then put into a cell, the copy one is on d5 and paste one is d7
so instead of doing filepathopen since i have this in different modules i figured that if i had the text of the file path somewhere i can reference it and then use it in all modules and the filepathopen code is only used once where the user selects the copy and paste files
is there a way to fix/edit my code so this error doesnt happen and that it can use that file path text and just do to the sheet asked in that case "Sch C" copy the range then paste it into the other file pastes sch c range?
thank you!
code:
Sub Get_data()
Application.ScreenUpdating = False
copy_wb = ThisWorkbook.Worksheets("File Paths").Range("D5").Value
paste_wb = ThisWorkbook.Worksheets("File Paths").Range("d7").Value
-> copy_wb.Worksheets("Sch C").Range("f12:f13").Copy
paste_wb.Worksheets("Sch C").Range("E11:E12").Offset(, myvalC).PasteSpecial Paste:=xlPasteValues