Md. Abdul Kader

About author

MD. ABDUL KADER is an engineer with a talent for Excel and a passion for VBA programming. To him, programming is like a time-saving wizard, making data manipulation, file handling, and internet interactions a breeze. His skill set extends to SWM, GIS, RS, and SPSS. He holds a B.Sc in Urban & Regional Planning from Chittagong University of Engineering and Technology and has shifted to become a content developer. In this role, he crafts technical content centred around Excel and VBA. Outside the professional realm, catch him immersed in books, exploring new places during travels, and watching movies.

Designation

Team Leader at ExcelDemy in SOFTEKO.

Lives in

Dhaka, Bangladesh.

Education

B.Sc in Urban & Regional Planning, Chittagong University of Engineering and Technology

Expertise

SWM, GIS, RS, SPSS, MS Excel, PowerQuery, PowerPivot & VBA

Experience

  • Technical Content Writing
  • Team Management

Summary

  • Currently working as Team Leader of ExcelDemy.
  • He started writing technical content for Excel & VBA for ExcelDemy in 2021.

Latest Posts From Md. Abdul Kader

0
Sum Values Based on Date in Excel (4 Ways)

Here's a sample dataset that will be used to explain the concept of sum values based on dates in Excel. It's a simple sales table with the date of the sale and ...

0
Excel COUNTIF with Greater Than and Less Than Criteria

  Download the Practice Workbook COUNTIF Greater than and Less than.xlsx 6 Examples of Using COUNTIF to Count Cells in Excel for Greater Than ...

0
How to Round to Nearest 100 in Excel (6 Quickest Ways)

As shown in the following figure, we have the unit price for each Product ID. Let's round the unit prices to the nearest 100. Method 1 - Using the ...

0
How to Split One Cell into Two in Excel (5 Useful Methods)

  We have a dataset where column B consists of full names. We have to split the cells of column B into two columns, e.g., first name and last name. ...

0
How to Convert Number to Text with Leading Zeros in Excel: 9 Methods

Method 1 - Using Text Format to Convert a Number in Excel with Leading Zeros Steps Select a blank cell or cell range where you want to use the format. ...

0
How to Count Cells That are Not Blank in Excel – 8 Methods

The dataset contains dollar values in Accounting format. Method 1 - Using the COUNTA Function Steps: Go to D10 and enter the following ...

0
How to Automatically Update One Worksheet from Another Sheet in Excel

Let’s say we have the following dataset in our source worksheet: Employee Name, Working Day, and Total Salary, and we want to automatically update any changes ...

0
How to Calculate the Average Percentage in Excel – 3 Easy Methods

Percentage Basics A percentage is a quantity or ratio that is a fraction of 100. Divide the number by the whole number and multiply by 100 to calculate the ...

0
How to Calculate Percentage Increase Between Three Numbers in Excel

Method 1 - Percentage Change Between Two Numbers Percentage change can be two types. Percentage Increase Percentage Decrease When the second value ...

0
How to Multiply Two Columns and Then Sum in Excel (3 Examples)

Example 1 - Multiply Two Columns and Sum Their Products Using SUMPRODUCT Function in Excel Multiply column D and column E. The cell range for quantity is ...

0
How to Copy Only Visible Cells in Excel (Some Quick Methods)

To illustrate how to copy only visible cells in Excel, we'll use a sample worksheet data with hidden rows (9 to 17). Method 1 - Using Keyboard ...

0
How to Shift Cells Down in Excel (5 Easy Methods)

  Method 1 – Using the Keyboard Shortcut  Steps: Select the cell or cell range you want to shift down. Press the shortcut Ctrl+Shift+”+”. ...

Browsing All Comments By: Md. Abdul Kader
  1. Hello EAC,
    Thanks for your question. Most likely, you need to put a not equal sign (<>) inside the If…Then statement of your second code. So, the corrected second code will be as follows-

    Sub block()
    Dim hz As String
    Dim hz1 As String
    
    hz = InputBox("enter your password")
    hz1 = InputBox("repeat password")
    
    If hz <> hz1 Then
    MsgBox "The repeated password is not identical!", vbExclamation
    hz = ""
    hz1 = ""
    Else
    Columns("D:F").Select
    Selection.Locked = False
    Range("D8:F12").Select
    Selection.Locked = True
    Range("a1").Select
    ActiveSheet.Protect hz
    End If
    End Sub

    However, your used three codes are quite messy. I would like to suggest that you can use the following code to lock a specific cell range in all worksheets of your Excel file.

    Sub Lock_CellRange_AllSheets()
        Dim ws As Worksheet
        For Each ws In ActiveWorkbook.Worksheets
            ws.Unprotect Password:="1234" 'Replace the password if you want
            ws.Range("D8:F12").Locked = True 'Replace the cell range
            ws.Protect Password:="1234", UserInterfaceOnly:=True 'Replace the password with the actual password for the workbook if it is protected
        Next ws
    End Sub

    Again, try this code to unlock the specific cell range in all worksheets.

    Sub Unlock_CellRange_AllSheets()
        Dim ws As Worksheet
        For Each ws In ActiveWorkbook.Worksheets
            ws.Unprotect Password:="1234" 'Replace the password if you want
            ws.Range("D8:F12").Locked = False 'Replace the cell range
            ws.Protect Password:="1234", UserInterfaceOnly:=True 'Replace the password with the actual password for the workbook if it is protected
        Next ws
    End Sub

    I hope these will work! Moreover, you can follow lock and unlock cells using VBA to explore more efficient methods.

  2. Hello Michael,
    Please specify your problem in detail or send the excel file via [email protected] email address.

  3. Dear Deka,
    It’s nice to hear from you with such wonderful appreciation. I myself always try to represent Excel applications in a more user-friendly way. And we, the ExcelDemy team, are working as a one-stop Excel solution provider.
    Thanks, and take care of yourself. Goodbye!
    Md. Abdul Kader
    Editor, ExcelDemy.

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo