OK, so I figured it out. The code is posted below for those who are facing similar issues.
Sub Copy_Data()
Dim WS As Worksheet
Dim ST As String
ActiveSheet.Protect userinterfaceOnly:=True
ST = Left(Range("PREP_BY"), 8)
For Each WS In Worksheets
' If WS.CodeName <> "Sheet1" And WS.Range("ST") = "PREPARED" Then
If WS.CodeName <> "Sheet1" And WS.Range("C1") <> "" Then
Sheet1.Range("PART_NUM").Copy
WS.Range("PART_NUM").PasteSpecial Paste:=xlPasteValues
End If
Next
End Sub
I am calling this Sub from a "Before Save" event, so that when the user clicks "Save" - any changes he has made to the "Part Number" (ie, PART_NUM) will be propagated across all worksheets, and because I put the "If" statement in there, it propagates the changes to all the NEW sheets, but NOT the older ones which are formatted differently (the older ones do NOT have text in C1, which is why I can use the logical ...And WS.Range("C1") <> "" Then...
Even though it answers both questions I had (it copies the information to the sheets I want, but not the sheets I don't want), I have a question that I'm curious about, regarding the statement of code I have commented out above:
If WS.CodeName <> "Sheet1" And WS.Range("ST") = "PREPARED" Then
Why will this not work? It gives me a 1004 error: Method Range of Object _Worksheet failed
Anyway, just wanted to say that I'm proud that my knowledge of VBA is growing, and I thank the ppl on the forum for assisting in expanding my knowledge. So, thanks to everyone who has helped me w/ my questions, and who have answered questions of others such that those of us w/ similar questions & issues can learn!!
Bookmarks