kalcerro_1
New Member
- Joined
- Feb 28, 2020
- Messages
- 27
- Office Version
- 365
- Platform
- Windows
Hello All,
i'm new with VBA and the forum.
I have access to this macro where I reset the sheet to a original state.
I want to modify it, not to delete the information in the first column, how do I reach this?
Here is the macro:
i'm new with VBA and the forum.
I have access to this macro where I reset the sheet to a original state.
I want to modify it, not to delete the information in the first column, how do I reach this?
Here is the macro:
VBA Code:
Private Sub Cmdbt_Reset_Click()
Dim rw As Integer
Dim cl As Integer
rwini = 0
rw = 0
cl = 0
Me.Unprotect ("TTTTT")
lop = True
If MsgBox("Do you really want to reset this skill matrix? It will take some seconds.", vbYesNo + vbQuestion) = vbYes Then
Me.Cells(3, 1).Value = ""
Me.Cells(3, 2).Value = ""
Me.Cells(5, 1).Select
MaxRows
GoTo RESETFORM
Else
rwini = ActiveCell.Row
GoTo NORESET
End If
RESETFORM:
Me.Cells(firstrow, 1).Select
lop = True
For rw = firstrow To rwini
Me.Cells(rw, 1).Value = ""
Me.Cells(rw, 2).Value = ""
Me.Cells(rw, 3).Value = ""
If IsOdd(rw) Then
Me.Cells(rw, 1).Interior.ColorIndex = 2
Me.Cells(rw, 2).Interior.ColorIndex = 2
Me.Cells(rw, 3).Interior.ColorIndex = 2
Me.Cells(rw, 1).Font.ColorIndex = 1
Me.Cells(rw, 2).Font.ColorIndex = 1
Me.Cells(rw, 3).Font.ColorIndex = 1
Else
Me.Cells(rw, 1).Interior.ColorIndex = 24
Me.Cells(rw, 2).Interior.ColorIndex = 24
Me.Cells(rw, 3).Interior.ColorIndex = 24
Me.Cells(rw, 1).Font.ColorIndex = 1
Me.Cells(rw, 2).Font.ColorIndex = 1
Me.Cells(rw, 3).Font.ColorIndex = 1
End If
Next rw
For rw = firstrow To rwini
For cl = frstcl To lstcl
If Me.Cells(rw, cl).Locked = False Then
Me.Cells(rw, cl).Value = "X"
Me.Cells(rw, cl).Interior.ColorIndex = 15
Me.Cells(rw, cl).Font.ColorIndex = 1
End If
Next cl
Next rw
For rw = firstrow To rwini
For cl = frstclpt To lstclpt
If Me.Cells(rw, cl).Locked = False Then
Me.Cells(rw, cl).Value = "X"
Me.Cells(rw, cl).Interior.ColorIndex = 15
Me.Cells(rw, cl).Font.ColorIndex = 1
End If
Next cl
Next rw
MsgBox ("The skills matrix has been reset."), vbInformation
Me.Cells(firstrow, 1).Activate
NORESET:
Me.Protect ("TTTTTT")
End Sub