Hello,
I have a very basic macro to copy a sheet to a new worksheet. This macro is tied to a button which works fine. The problem that I am running into is that the sheet that I am using as my source for the copy also has some code in it. This code is traveling with the copy however it references "Sheet2" and does not update to reference the newly created copy sheet name. I would guess that this is an easy fix, however I haven't been able to find anything online. HELP!
Here is a sample of one line of code from the worksheet that is being copied. I need "Sheet2" to update to the sheet name of the newly created sheet. Or if there is a way to avoid referencing the sheet that might work as well.
If Sheet2.Cells(22, 21).Value = 2 Then
I have a very basic macro to copy a sheet to a new worksheet. This macro is tied to a button which works fine. The problem that I am running into is that the sheet that I am using as my source for the copy also has some code in it. This code is traveling with the copy however it references "Sheet2" and does not update to reference the newly created copy sheet name. I would guess that this is an easy fix, however I haven't been able to find anything online. HELP!
Here is a sample of one line of code from the worksheet that is being copied. I need "Sheet2" to update to the sheet name of the newly created sheet. Or if there is a way to avoid referencing the sheet that might work as well.
If Sheet2.Cells(22, 21).Value = 2 Then