dparteka
Member
I've been attempting to put this together and have concluded it's just beyond my skill level, any help would be awesome and greatly appreciated... thanks for looking.
I'm using the code shown below which looks in column-A for "+", then for all rows that have this character it locks each cell in that row and then protects the sheet, I'm hoping to expand this to also include the following only in those rows that have "+" in column-A:
a. Remove all conditional formats
b. Remove all data validations
c. Replace all formulas with Values
d. Change all fonts to black
e. Change all “+” to “-“
Here's everything that should happen
1. Unprotect the worksheet
2. Remove all conditional formats
3. Remove all data validations
4. Replace all formulas with Values
5. Change all fonts to black
6. Change all “+” to “-“
7. Lock each cell
8. Protect the worksheet
I'm using the code shown below which looks in column-A for "+", then for all rows that have this character it locks each cell in that row and then protects the sheet, I'm hoping to expand this to also include the following only in those rows that have "+" in column-A:
a. Remove all conditional formats
b. Remove all data validations
c. Replace all formulas with Values
d. Change all fonts to black
e. Change all “+” to “-“
Here's everything that should happen
1. Unprotect the worksheet
2. Remove all conditional formats
3. Remove all data validations
4. Replace all formulas with Values
5. Change all fonts to black
6. Change all “+” to “-“
7. Lock each cell
8. Protect the worksheet
Code:
Private Sub CommandButton2_Click()
ActiveSheet.Unprotect
Dim rChk As Range, r1st As Range
Set r1st = Columns("A").Find(What:="+", _
after:=Cells(Rows.Count, "A"), _
LookIn:=xlValues, LookAt:=xlPart, _
searchdirection:=xlNext)
If Not r1st Is Nothing Then '+ is found
Set rChk = r1st
Do
rChk.EntireRow.Locked = True
Set rChk = Columns("A").FindNext(after:=rChk)
Loop While rChk.Address <> r1st.Address ' else endless loop
End If
Set r1st = Nothing
Set rChk = Nothing
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowSorting:=True, AllowFiltering:=True
End Sub