Reset Excel Sheet without delete first column

kalcerro_1

New Member
Joined
Feb 28, 2020
Messages
27
Office Version
  1. 365
Platform
  1. 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:

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
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

Forum statistics

Threads
1,144,628
Messages
5,725,378
Members
422,622
Latest member
Paranthem

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top