Fuddy_Duddy
New Member
- Joined
- Apr 24, 2024
- Messages
- 10
- Office Version
- 2016
- Platform
- Windows
This Worksheet_Change refuses to work. When I execute it from a macro, it works fantastically. But not as a Worksheet_Change. And it's the only change for the sheet.
Please help.
Thanks in advance.
Here's the code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("D10").Address Then
' Gets the Number of Lines-to-Date from the Individual "COPY_for_Recipe_" File
Dim openFilename As String
Dim LineAnswer As String
openFilename = Range("K9")
If Range("K9") <> "ENTER FILE NUMBER" And Range("D11") <> "NO SELECTION" Then
Workbooks.Open Filename:= _
"D:\DIGITAL RESOUIRCE, LLC\COOKING_CHANNEL\COPY_for_EPISODES_AQR\COPY_for_" & openFilename & ".xlsm"
Windows("COPY_for_" & openFilename & ".xlsm").Activate
Sheets("Script").Select
Sheets("Script").Unprotect
LineAnswer = Range("AZ2")
Sheets("Script").Protect
Windows("Word_Count_Utility.xlsm").Activate
Sheets("WORD_COUNT").Select
Sheets("WORD_COUNT").Unprotect
Range("O12") = LineAnswer
Sheets("WORD_COUNT").Protect
End If
End If
Please help.
Thanks in advance.
Here's the code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("D10").Address Then
' Gets the Number of Lines-to-Date from the Individual "COPY_for_Recipe_" File
Dim openFilename As String
Dim LineAnswer As String
openFilename = Range("K9")
If Range("K9") <> "ENTER FILE NUMBER" And Range("D11") <> "NO SELECTION" Then
Workbooks.Open Filename:= _
"D:\DIGITAL RESOUIRCE, LLC\COOKING_CHANNEL\COPY_for_EPISODES_AQR\COPY_for_" & openFilename & ".xlsm"
Windows("COPY_for_" & openFilename & ".xlsm").Activate
Sheets("Script").Select
Sheets("Script").Unprotect
LineAnswer = Range("AZ2")
Sheets("Script").Protect
Windows("Word_Count_Utility.xlsm").Activate
Sheets("WORD_COUNT").Select
Sheets("WORD_COUNT").Unprotect
Range("O12") = LineAnswer
Sheets("WORD_COUNT").Protect
End If
End If