Hi,
I'm having an issue with a particular bit of code. All the cells are unlocked prior to running the code. After I run the code, the cells also get locked up, which is not desired. I'm bashing my head trying to figure out why these cells are getting locked up, as nowhere do I have any command or code telling these cells to lock up. I've messed with the range, and it seems that when I modify the range, it'll lock the cells up to that point, and no further. ( Range("C9:K65536").Cells.Clear line of code )
Here is my code:
Could someone guide me in the right direction?
I'm having an issue with a particular bit of code. All the cells are unlocked prior to running the code. After I run the code, the cells also get locked up, which is not desired. I'm bashing my head trying to figure out why these cells are getting locked up, as nowhere do I have any command or code telling these cells to lock up. I've messed with the range, and it seems that when I modify the range, it'll lock the cells up to that point, and no further. ( Range("C9:K65536").Cells.Clear line of code )
Here is my code:
Code:
Sub DeleteEntryData()
Dim iRet As Integer
Dim strPrompt As String
Dim strTitle As String
' Promt
strPrompt = "Do you wish to delete the Entry tab data? This cannot be undone."
' Dialog's Title
strTitle = "Warning: Data Deletion"
'Display MessageBox
iRet = MsgBox(strPrompt, vbYesNo, strTitle)
' Check pressed button
If iRet = vbNo Then
MsgBox "Data will not be removed."
Else
MsgBox "Your entry data will be deleted. If this was accidental, please close the file without saving changes."
'Copies days since last empty
Sheets("Journal").Unprotect Password:="trend sheet"
Sheets("Journal").Select
Range("T5:T105").Copy
Range("U5").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Journal").Protect Password:="trend sheet"
Range("A1").Select
'Deletes entry data
Sheets("Entry").Select
Sheets("Entry").Unprotect Password:="trend sheet"
Range("C9:K65536").Cells.Clear
Sheets("Entry").Protect Password:="trend sheet"
Range("A1").Select
End If
End Sub
Could someone guide me in the right direction?