Hi there,
I have a vba code that's linked to update dynamic chart within a worksheet.
It is working fine however, how do I make it so that MACRO only runs on specific workbook and worksheet.![]()
Private Sub Worksheet_Calculate() Dim Target As Range Set taget = ActiveSheet.Range("$B$73") ActiveSheet.Unprotect Password:="1234" If ActiveSheet.Range("$B$73") = "Rate 1" Or ActiveSheet.Range("$B$73") = "Rate 2" Then ActiveSheet.Range("$C$79:$AO$84").NumberFormat = "0%" Else ActiveSheet.Range("$C$79:$AO$84").NumberFormat = "0.0" End If Application.EnableEvents = True ActiveSheet.Protect Password:="1234" End Sub
I've been having trouble when opening new documents it automatically protects the document with the same protect password.
I was thinking of doing [Thisworkbook.Sheets("SheetName").Range] to specify what I wanted but It doesn't seem to be working.
TL;DR - I do not want the macro to run for different workbook or worksheet. (Just 1 specific worksheet).
Thanks
Bookmarks