Here's my code in the before_save event of the workbook.
If ActiveWorksheet = Sheets("Sheet5") Then
Sheets("Sheet1").Activate
else
Exit Sub
End if
I previously had only the second line and it worked great but do to user complaints of the workbook activating sheet 1 before it saved I need to change it so that it will only activate sheet 1 before it saves if the active sheet at the time of save is sheet 5.
I am getting an error on the first line of the above code. What's wrong?
thanks,
If ActiveWorksheet = Sheets("Sheet5") Then
Sheets("Sheet1").Activate
else
Exit Sub
End if
I previously had only the second line and it worked great but do to user complaints of the workbook activating sheet 1 before it saved I need to change it so that it will only activate sheet 1 before it saves if the active sheet at the time of save is sheet 5.
I am getting an error on the first line of the above code. What's wrong?
thanks,