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
Excel VBA: UserForm Image from Worksheet (3 Cases)

While creating or modifying a UserForm, you may need to add or create images from the worksheet. In this instructive session, I’ll demonstrate 3 methods to add ...

0
How to Find and Replace within Selection in Excel (7 Methods)

Frequently, you may need to find a particular data, formatting, or even cell references and then replace it with something new. Find and Replace is one of the ...

0
How to Use Dynamic Range for Last Row with VBA in Excel (3 Methods)

The VBA Dynamic Range provides you the opportunity to use the same code for newly added or removed data while working with a larger dataset. However, it will ...

0
VLOOKUP Date Range and Return Value in Excel: 4 Methods

Let’s introduce today’s dataset where the name of the Items is provided along with Order Dates, Unit Price, Quantity and Sales. Method 1 - VLOOKUP a ...

0
How to Change Date Format in Pivot Table in Excel

Pivot Table, one of the powerful features in Excel, analyzes the larger dataset efficiently. But probably you have faced the problem of date formatting in the ...

0
How to Count Unique Values in Filtered Column in Excel (5 Methods)

If you have a larger dataset and you need to apply filters in columns. More importantly, you might require to count only unique values except for the duplicate ...

0
How to Convert Number to Text without Scientific Notation in Excel

Once you input any data for example a number, it will be stored typically as a number. More importantly, if the number of digits is greater than 15, your input ...

0
How to Combine Cells into One with Line Break in Excel (5 Methods)

Sometimes we need to combine multiple cells into one keeping with the line break. Undoubtedly, Excel provides some quickest features to do that. In this ...

0
How to Lock Multiple Cells in Excel (6 Suitable Methods)

Basically, you may need to lock multiple cells for two reasons. One is to lock cells for protecting them from further edits or changes whereas the other reason ...

1
How to Apply Conditional Formatting in Excel If Another Cell Is Blank

Perhaps you may have a larger dataset with numerous blank cells. Using a popular highlighting tool i.e. Conditional Formatting, you are easily able to ...

0
[Fixed] Excel Print Error Not Enough Memory

Sometimes you may get troubled while printing any large Excel datasets or charts. But you can fix this issue using some handy methods. Prior to fixing this ...

0
How to Delete Row Using Macro If Cell Contains 0 in Excel (4 Methods)

Frequently you may need to omit unnecessary cells containing specific cell values that are no longer useful for you. For example, you might delete those rows ...

0
How to Count Duplicates in Two Columns in Excel (8 Methods)

Probably you have a larger dataset with duplicates and non-duplicates values and you need to count the number of duplicates. If you’re looking for such types ...

0
How to Copy Rows in Excel with Filter (6 Fast Methods)

Often you may need to copy filtered rows in Excel. And this task can be accomplished using Excel as well as the VBA code. In this article, I’ll show you 5 ...

1
How to Autofilter and Copy Visible Rows with Excel VBA

You can easily apply the auto filter in Excel except using VBA code. But copying the filtered visible rows in the existing or a new working sheet is a tiresome ...

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