Good morning.
I have some basic VBA knowledge but am stumped with this one - have searched various forums but can't find the answer I need so am hoping one of you experts can point me in the right direction.
I have a spreadsheet with 3 sheets - Instructions, Variance and Data.
The Data sheet has a breakdown of information per week in each column.
I am trying to write a macro that will copy a column from the Data sheet and paste special it in column B on the Variance sheet if the value in Row 4 of the Data sheet is equal to the value in cell B4 of the Instruction Sheet.
The value in cell B4 of the Instruction sheet will change every week and I want the information from the data sheet to overwrite column B on the Variance sheet every week.
I have tried using an If Then statement
If Sheets("Data").Range("B4:ZZ4").Value = Sheets("Instructions").Range("C4") Then EntireColumn.Copy Sheets("Variance").Range("B1")
However, I get the RunTime error Type mismatch.
The data in the cells is a date and I have used the same format on both the Instructions and the Data sheet and can't work out why they don't match - have even copies the cell from the Data sheet to the Instructions sheet so I know they are identical.
Could someone please put me out of my misery!
Thank you
I have some basic VBA knowledge but am stumped with this one - have searched various forums but can't find the answer I need so am hoping one of you experts can point me in the right direction.
I have a spreadsheet with 3 sheets - Instructions, Variance and Data.
The Data sheet has a breakdown of information per week in each column.
I am trying to write a macro that will copy a column from the Data sheet and paste special it in column B on the Variance sheet if the value in Row 4 of the Data sheet is equal to the value in cell B4 of the Instruction Sheet.
The value in cell B4 of the Instruction sheet will change every week and I want the information from the data sheet to overwrite column B on the Variance sheet every week.
I have tried using an If Then statement
If Sheets("Data").Range("B4:ZZ4").Value = Sheets("Instructions").Range("C4") Then EntireColumn.Copy Sheets("Variance").Range("B1")
However, I get the RunTime error Type mismatch.
The data in the cells is a date and I have used the same format on both the Instructions and the Data sheet and can't work out why they don't match - have even copies the cell from the Data sheet to the Instructions sheet so I know they are identical.
Could someone please put me out of my misery!
Thank you