Diving_Dan
Board Regular
- Joined
- Oct 20, 2019
- Messages
- 161
Hi all,
I've scoured the internet again after trying to adapt some code I have previously used and tried the macro recorder but am getting no joy.
I have a workbook where weekly tasks are given to employees. This is the activeworkbook where I am putting the code into. I then have a second sheet called master stored in a different path.
C3 on the activeworkbook contains a date. I am trying to open the other workbook and then find that date within column A. Once that is done I will be able to use offset to input the data from the active book but before I can get to there I need to be able to find the date.
Below is the code I have so far. The master workbook opens ok but I then get an error when the find tries to run. I get the error message object variable or with block variable not set. I'm not sure where I'm going wrong. Any help is appreciated as always.
Dan
I've scoured the internet again after trying to adapt some code I have previously used and tried the macro recorder but am getting no joy.
I have a workbook where weekly tasks are given to employees. This is the activeworkbook where I am putting the code into. I then have a second sheet called master stored in a different path.
C3 on the activeworkbook contains a date. I am trying to open the other workbook and then find that date within column A. Once that is done I will be able to use offset to input the data from the active book but before I can get to there I need to be able to find the date.
Below is the code I have so far. The master workbook opens ok but I then get an error when the find tries to run. I get the error message object variable or with block variable not set. I'm not sure where I'm going wrong. Any help is appreciated as always.
Dan
VBA Code:
Sub copy_to_master()
Dim Var As String
Dim wb As Workbook
Var = Range("C3").Value
Set wb = ThisWorkbook
Workbooks.Open "C:\All DEPTS\Master.xlsx"
Range("A:A").Find(What:=Var).Activate
End Sub