MD Tanvir Rahman

About author

Hello, I am Tanvir, graduated from BUET. Previously worked in a reputed Metal and Plastic Can Manufacturing company. On that short year long tenure, I found MS Excel is the most unique and useful software that reduce both time and paper consumption. Now, I am an Excel enthusiast, love to deal with new inscrutable daunting shortcomings and publish contents on Exceldemy.com.

Latest Posts From MD Tanvir Rahman

0
How to Extract Data from Excel? (10+ Basic & Advanced Methods)

Data Extraction is the approach of gathering particular data from a source or replicating the data from somewhere else. In this Excel tutorial, you will learn ...

0
How to Add, Change and Format Cell Borders in Excel [Ultimate Guide]

In this Excel tutorial, you will learn how to add, change, format, draw, remove, and create custom styles for cell borders in Excel, and even how to work with ...

0
[Fixed!] VBA Worksheet Change Is Not Working (3 Effective Fixes)

This content elaborates on the VBA Worksheet Change not working regarding possible reasons and their remedial approaches. Just think about your task, you ...

1
Excel VBA to Calculate Active Sheet (6 Practical Applications)

Have you ever discovered that Excel does not always accurately compute formulas? I imagine that we have all worked with Excel files that were enormous and ...

0
Excel VBA Do While Continue

In this article, we will demonstrate the duplicate use of the Excel VBA Do While Continue statement. Continue statement allows you to skip all the remaining ...

0
How to Use Excel VBA Try Catch (3 Suitable Examples)

Most computer programming languages provide the Try...Catch...End syntax. Make an effort to avoid making errors, misfits, and mistakes. Nevertheless, if an ...

0
Excel VBA Function to Return Multiple Values

Generally, a function can output a single value at a time while using the Excel VBA function. Any type of data can be declared that is supported by Excel VBA ...

0
Excel VBA: Declare Global Variable and Assign Value

It appears to be quite easy to declare a variable. However, in order to have excellent practical experience, we must comprehend the range of those factors. In ...

0
How to Use SUMIF to SUM Less Than 0 in Excel (3 Easy Ways)

In this article, we will illustrate how to use the Excel SUMIF function to sum values less than 0. Profit and loss are highly related to business. In Some ...

1
[Fixed!] VBA Loop Without Do Error (3 Possible Reasons)

Loop without Do is a common error in Excel VBA Macro. Most of us often face this problem continuously. Predominantly this is a compile error and plays hide and ...

1
How to Format Slicer in Excel (7 Common Options)

Excel Slicer allows you to present your data visually appealing and easy to understand. Slicer is a powerful feature in Excel that only filters data and ...

0
SmartArt in Excel: All Things You Need to Know

Drawing shapes and adding text boxes is tiring and time-consuming. SmartArt in Excel is a feature introduced by Microsoft that has a set of pre-defined layouts ...

0
Hide Rows in Excel (Using Shortcuts, Commands and VBA)

In this context, we will explain approaches to hide rows in Excel. While constructing approaches, we will use the Format command, keyboard shortcut, and Group ...

0
Transpose in Excel (Applying Functions, Commands, and VBA)

In this Excel tutorial, you will learn to transpose in Excel by applying 10 useful approaches addressing numerous tools such as Paste Special, Find and ...

0
How to Find Duplicates in Excel? (All Criteria Included)

Finding duplicates in Excel means highlighting or extracting the number of multiple instances of the same values. In this Excel tutorial, you will learn how ...

Browsing All Comments By: MD Tanvir Rahman
  1. Dear MARCO, Thanks a ton, and my heartfelt gratitude to you.
    Query 1: #NAME? error
    Considering you are trying the code mentioned in the content. However, there are several reasons for getting #NAME? error in Excel.
    Issue 1: The code contains custom custom-created Public Function. So, when you download the file from our site, by default it it may be blocked by your local administration. Macro remains disabled in the blocked file. So, you must unblock the file by selecting File > Right-Click on Mouse > Properties > Check Unblock.
    Issue 2: Spelling mistake in the function name shows #NAME? error.
    Issue 3: Incorrect range and cell references also lead to #NAME? error.
    To learn more about #NAME? error, go through #NAME? error in Excel.

    Query 2: Convert Km instead of Miles
    The mentioned code returns the outcome in Miles. However, you can convert Miles into Kilometers by inserting the following formula.
    =(Calculate_Distance(C8,C9,C11))*1.61
    or,
    =CONVERT(Calculate_Distance(C8,C9,C11),”mi”,”km”)

    Thanks for reaching out. We team Exceldemy are here to assist you. Please let us know if you face any other shortcomings.

    Regards,
    MD Tanvir Rahman
    Excel and VBA Content Developer
    Exceldemy, Softeko.

  2. Dear Jae, You have my heartfelt gratitude. I found your queries quite distinctive and innovative. Yes, you can find out Names based on multiple data. Although there is no single functions in VBA that can extract result based on data, you must apply multiple VBA functions such as SPLIT, COUNTA, OFFSET, IF to get the job done.

    Step 1: Write the VBA code in the module and hit the Run icon.
    Applying VBA Macro to find names based on Multiple Data
    VBA Code

    
    Sub Find_Names_Based_on_Multiple_Data()
    Dim rng As Range
    Dim words() As String
    Dim ws As Worksheet
    Dim text As String
    Dim i As Long
    Dim j As Long
    Dim countResult As Long
    Set rng = Range("A1:A8")
    Set ws = ThisWorkbook.ActiveSheet
    
    'Clearing cells of output
    Range("B2:D8").Delete
    Range("A13:A17").Delete
    
    For i = 2 To rng.Rows.Count     'Executing FOR loop to consider each row
        text = Cells(i, 1).Value    'Picking up cell values from A2:A8 range
        words = Split(text, " ")    'Applying Array to split based on space
            For j = 2 To UBound(words) + 2  'Applying FOR loop for column counting
                ws.Cells(i, j).Value = words(j - 2) 'split data based on column A
            Next j
        'Counting column containing text in each row
        countResult = Application.WorksheetFunction.CountA(Range("B" & i & ":E" & i))
        If countResult = ws.Range("B10").Value Then     'matching column no to Value of B10
            If ws.Cells(13, 1).Value = "" Then  'If there is no  value then write output in A13
                ws.Cells(13, 1).Value = Cells(i, 1).EntireRow.Value
            Else    'If multiple value appears then write below the existing
                ws.Cells(ws.Rows.Count, 1).End(xlUp).Offset(1, 0).Value = Cells(i, 1).EntireRow.Value
            End If
        End If
    Next i
    End Sub
    

    Step 2: Obtain output as follows.
    Find Names Based on Multiple Data

    Thanks a ton. Have a good day.
    Regards,
    MD Tanvir Rahman
    Excel and VBA Content Developer
    ExcelDemy, Softeko

  3. Hello Nathan, Thanks for your observation. I got your shortcoming. This article focuses on removing links of local storage before opening Excel Spreadsheet files.
    However, probably you are likely to remove hyperlinks such as doc links, youtube links, any website links. To remove hyperlinks, you can follow the article: Remove Hyperlinks from Excel Worksheets
    I hope now you will be able to fix the issue. For any further shortcomings please let me know. We, team ExcelDemy are ready to assist you.
    Thanks a ton. Have a good day.

    Regards,
    MD Tanvir Rahman
    Excel and VBA Content Developer
    ExcelDemy, Softeko

  4. Hello! Peter Atallah, Thanks for the Query. It sounds like you’re encountering an issue with the “Find and Replace” feature in Microsoft 365 Apps for Enterprise, where you used to see a message box indicating the number of replacements made, but it’s no longer appearing. Here are a few steps you can try to troubleshoot and resolve this issue:
    1. Check Notification Settings: Make sure that notifications are enabled in your Microsoft Office settings. Sometimes, notifications may have been disabled, which could prevent the message box from appearing.
    2. Update or Repair Office Installation: Ensure that your Microsoft Office installation is up to date. Sometimes, issues can arise due to outdated software. If updating doesn’t work, you could also try repairing your Office installation. To do this, go to “Control Panel” > “Programs and Features,” select Microsoft Office, and choose “Change.” Then, select “Repair” and follow the prompts.
    3. Reset Office Settings: If the issue persists, you can try resetting your Office application settings to their defaults. To do this, open any Office application (e.g., Word), go to “File” > “Options” > “Advanced,” and click the “Reset” button under the “Reset” section. Please note that this will revert all customizations back to their default settings.

    Please feel free to let us know the update after trying these approaches.
    Thanks a ton. Have a good day.
    Regards,
    MD Tanvir Rahman
    Excel and VBA Content Developer
    ExcelDemy, Softeko

  5. Dear Lorenzo Pomini, Thank you so much for your queries. Probably Excel file location is not correct or you forgot to rename a sheet as “January“. However, please follow the mentioned steps. I hope it works.
    Step 1: Make sure you created 2 or more worksheets in a preferred location.
    Create excel files

    Step 2: Create a worksheet named “January”
    Creating excel worksheet

    Step 3: Insert the following code in the module and hit the Run button.
    Inserting VBA code in the module

    Code Explanation:

    
    Do While File_Name <> ""    'Executing loop while file_name is not blank
        Set File = Workbooks.Open(Filename:=File_Path & File_Name)  'Opening files
        File.Worksheets(Sheet_Name).UsedRange.Copy   'Copying used range from each workbook
        ActiveColumn = ActiveColumn + 1     'Moving to column number once it pickup the value
        New_Workbook.Worksheets(Sheet_Name).Cells(1, ActiveColumn).PasteSpecial Paste:=xlPasteAll
            'Pasting the value in the January worksheet of the new workbook
        ActiveColumn = ActiveColumn + File.Worksheets(1).UsedRange.Columns.Count
            'Counting the column number for increment
        File_Name = Dir()
    Loop
    

    Step 4: Select the folder to where Excel files are located.
    Selecting folder to import excel files

    Step 5: Obtain outcome containing data of 2017, 2018, 2019, 2020 in the January worksheet of the active workbook.
    importing data from the Excel workbooks

    I hope these steps will be helpful to you. Please let me know if you face any further shortcomings. Thanks a ton. Have a good day.
    Regards,
    MD Tanvir Rahman
    Excel and VBA Content Developer
    Exceldemy, Softeko.

  6. Dear Brittany, Thank you so much for your distinctive query. Here we are setting up a sample dataset of Electronics, Fashion and Snacks category. Using the following formula containing IF function in the D5 cell, you will be able to call the value of cells of the row once it is matched to a cell of same column.
    =IF(C5=C$2,D$2,IF(C5=C$3,D$3,IF(C5=C$4,D$4,”Uncategorized”)))
    Inserting IF function formula to autofil the cells in a row
    Now drag the Fill Handle tool to fill the cells automatically.
    Using Fill Handle tool to fill the cells
    I hope, the solution will be fruitful to you. For any further shortcomings, don’t forget to reach us. Have a good day.
    Regards,
    MD Tanvir Rahman
    Excel and VBA Content Developer
    Exceldemy, Softeko

  7. Dear Savvas, You are most welcome. Your encouraging words motivate us a lot. Please stay tuned with Exceldemy for amazing contents.
    Regards,
    MD Tanvir Rahman
    Excel and VBA Content Developer
    Exceldemy, Softeko

  8. Hello Asmitha, Thanks for your query. I found it very fascinating. Yes, we can insert a image in the A1 cell and export it to the Outlook in the middle of the email body.
    Put the following VBA code in the module and get the output like below image.
    Inserted a image in the middle of email body from Excel with VBA Macro

    
    Sub Insert_Image_Into_Excel_And_Send_Email()
        Dim imagePath As String
        imagePath = "E:\tanvir\Job\Softeko\Article\Exceldemy\Comment\1\a.png" ' Replace with your directory
    
        Dim ws As Worksheet
        Set ws = ThisWorkbook.Sheets("Sheet1") ' Replace "Sheet1" with the name of your worksheet
    
        ' Insert the image into cell A1
        With ws.Shapes.AddPicture(imagePath, True, True, 0, 0, -1, -1)
            .Left = ws.Range("A1").Left
            .Top = ws.Range("A1").Top
            .Width = ws.Range("A1").Width
            .Height = ws.Range("A1").Height
        End With
    
        ' Send the email with the image attached
        Send_Email_With_Image_Attachment imagePath
    End Sub
    
    Sub Send_Email_With_Image_Attachment(imagePath As String)
        Dim OutlookApp As Object
        Dim OutlookMail As Object
        Dim HTMLBody As String
    
        ' Create a new instance of Outlook
        Set OutlookApp = CreateObject("Outlook.Application")
        Set OutlookMail = OutlookApp.CreateItem(0)
    
        ' Compose the email
        With OutlookMail
            .Subject = "Email with Image Attachment"
            .To = "[email protected]" ' Replace with the recipient's email address
            .CC = "[email protected]" ' Replace with CC email addresses (if needed)
            .HTMLBody = "Hi," & vbNewLine & vbNewLine & "This is an image attached from Excel:" & vbNewLine & vbNewLine & "<br><br>" & "<img src='" & imagePath & "'><br><br>" & _
                        "Regards," & vbNewLine & "Your Name"
    
            ' Attach the image to the email
            .Attachments.Add imagePath, olByValue, 0 ' olByValue is used to attach by value, not by reference
    
            ' Uncomment the next line if you want to send the email immediately (be careful)
            ' .Send
    
            ' Show the email draft for review before sending (comment this line if you want to send immediately)
            .Display
        End With
    End Sub
    

    Thanks a ton and have a good day.
    Regards,
    MD Tanvir Rahman
    Excel and VBA Content Developer
    Exceldemy, Softeko

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo