Bhubon Costa

About author

Bhubon Costa, B.Sc. in Naval Architecture & Marine Engineering from Bangladesh University of Engineering & Technology, has worked with the ExcelDemy since 2021. Currently, he has been working as a reviewer. Notably, he has written over 90 articles and led several VBA content development teams. He has a great passion for the fields of data analytics and data science. His areas of expertise include Excel VBA, Power Query, Pivot Table, Power BI, MySQL, PostgreSQL, machine learning, and Python automated dashboards.

Designation

Team Leader at ExcelDemy in SOFTEKO.

Lives in

Dhaka, Bangladesh.

Education

B.Sc. in Naval Architecture And Marine Engineering, Bangladesh University of Engineering and Technology

Expertise

Data Analysis, Content Writing, C, C++, Python, HTML, SQL, MySQL, Supply Chain Management, Industrial Design, AutoCAD, Maxsurf, Rhino 3D, and 3D Modeling.

Experience

  • Team Leader, SOFTEKO
  • Led 30+ members of content developers to produce high-quality, SEO-optimized content
  • Provided solutions using VBA macros to automate tasks and improve efficiency.
  • Managed project timelines and resources to ensure the timely delivery of projects.
  • Conducted training sessions for team members to enhance their skills and knowledge.
  • Technical Content Writer, SOFTEKO
  • Published 100+ tutorials on Advanced Excel and VBA Macro
  • Assistant Engineer, Meghna Group of Industries
  • Project planning for the new building.
  • Design-related practical problem-solving.
  • Material procurement and distribution.
  • Ship operation (MMD and Class Survey)
  • Ship docking, repair planning, and maintenance.

Achievements, Awards & Co-curricular Activities

  • ISCEA PTAK PRIZE GLOBAL CASE COMPETITION 2017 Scholarship Winner (Supply Chain Management). Our team, BUET-​01​​1​0-17 got selected for a scholarship worth $770.
  • Community Involvement – AHOBAN Foundation. AHOBAN Foundation is a youth-based organization dedicated to the betterment of underprivileged and poverty-stricken people in Bangladesh.
  • Senior Math Instructor -Learners Teaching Home, Mirpur, Dhaka.
  • Model Ship Propulsion Competition 2016 - Issued by 10th International Conference on Marine Technology 2016.
  • Team speaker in the International Conference On Marine Technology (MARTEC 2022). Later, get accepted into the journal of SSRN. Paper Title: Automated Handling of Port Containers Using Machine Learning

Latest Posts From Bhubon Costa

0
How to Protect an Excel Sheet Except for Certain Cells (2 Ways)

We'll use the following sample dataset to protect the sheet except for select cells. Method 1 - Use the Protect Ribbon to Protect an Excel Sheet Except ...

0
How to Auto Backup Excel File: 2 Easy Methods

Method 1 - Use Excel’s General Options to Auto Backup an Excel File Step 1: Create an Auto Backup File Click the File tab. Select Save As. ...

0
How to Calculate the Time Difference in Minutes in Excel – 3 Methods

This is an overview. Method 1 - Using an Excel Formula to Calculate Time Difference in Minutes Step 1: Find the Time Difference in Dates Enter ...

0
How to Create an Employee Database in Excel – 5 Easy Steps

The following database showcases sample fields. Step 1 - Insert Basic Details to Create an Employee Database Enter each employee's name. ...

1
How to Transpose Rows to Columns Based on Criteria in Excel (2 Ways)

Download the Practice Workbook Transpose Rows to Columns with Criteria.xlsm 2 Handy Approaches to Transpose Rows to Columns Based on Criteria in ...

0
How to Convert CSV to XLSX – 8 Steps

In the following image, there is a CSV file. To convert it into an Excel file (.xlsx) Step 1 - Save the CSV File Save your CSV file (source) in a ...

0
How to Link a PDF Form to an Excel Database – 5 Steps

This is an overview: Step 1 - Create a PDF Form Open Adobe Acrobat PDF Reader. Click Tools. In the search box, enter ‘Prepare’ to the Prepare ...

0
How to Import Data into Excel from Another Excel File (2 Ways)

We've included a sample data set with a workbook named Subtotal Pivot Table in the image below. This worksheet's data will be imported into another workbook. ...

0
How to Split Column by First Space in Excel: 6 Easy Methods

Method 1 - Insert FIND Function find_text Argument Find the first space position number; type the find_text argument. =FIND(" ", Method ...

0
How to Calculate the Win-Loss Percentage in Excel – 8 Easy Steps

The dataset showcases the sales summary of 2 sequential periods. Step 1- Calculate the Percentage of Win-Loss for Each Entry in Excel To calculate ...

0
How to Insert a Column without Affecting Formulas in Excel (2 Ways)

In the following dataset, we will count the Total Sales from 2015 to 2020 for different months. However, we have missed including the Sales for 2016. So, we ...

0
How to Filter a Table based on Cell Values with Excel VBA (6 Methods)

Dataset Overview We've included a sample dataset in the figure below, from which we'll sift through values according to specific cell criteria. Using Excel ...

0
How to Extract Text After First Space in Excel (3 Suitable Ways)

This guide will use the sample dataset pictured below. Method 1 – Merging MID Function With FIND Function to Extract Text After the First Space in ...

0
How to Use Range with Variable Row and Column with Excel VBA

We will demonstrate 5 ways to create variable rows and columns. We'll use the following sample dataset with product prices, quantities, and sales. ...

0
How to Format Cell and Center Text with Excel VBA (5 Ways)

Method 1 - Run a VBA Code to Center Text Horizontally and Format Cell with Excel VBA 1.1 Center an Active Cell Horizontally In the image below; there is an ...

Browsing All Comments By: Bhubon Costa
  1. Greetings EDUARDO,

    Thanks for reaching out again. We are not facing the same issue from our side. But we are providing you with a possible solution to get rid of the issue. There could be problems with versions or with settings. We are using Microsoft 365.

    1. First, check that the Automatic option is enabled.

    2. Check that the Advanced tab options are the same as yours.

    3. Now, if you still face the issue, you can change the Copy Cells command to Fill Series in the AutoFill options.

    Please give us feedback if you have any further queries.

    Best Regards,
    Bhubon Costa, ExcelDemy

  2. Greetings EDUARDO,
    Yes, you have followed the procedures perfectly. But the thing is that you don’t need to press Ctrl to increase the number, as the numbers are already in an arithmetic progression. So, when you press Ctrl and drag down, you experience something like this:

    So, just drag down the AutoFill tool.

    Please give us feedback if you have any further queries.

    Best Regards,
    Bhubon Costa, ExcelDemy

  3. Greetings Andrija,
    There might be two reasons for your query. First, your default Outlook mail compose settings may not be in HTML format. Another one is that the table is pasted as Paste text and merge format (M).

    First solution:

    Go to the View tab in your Outlook app.

    Click on View Settings > Mail > Compose and reply.

    Select the HTML format for the Compose messages option.

    Second Solution:

    Your table might be compressed if you paste it as Paste text and merge format (M).

    Change it to Paste as is (P).

    We hope your issue will be resolved. Please let us know whether your issue is solved or not. The ExcelDemy team always welcomes your valuable feedback.

    Best regards,
    Bhubon Costa

  4. Greetings Frank,

    From your question, we can assume that your time format is formatted in [h] “hr”, mm “m”, ss “s” format. We need to change it into h:mm:ss format. You need to customize this format with the following steps.

    • Select the cells you need to change the time format.
    • Press Ctrl + 1 to open the Format Cells dialogue box.

    • Click on Custom.
    • Select h:mm:ss format.
    • Click OK.

    • Get your results in your desired time format.

    Best regards,
    Bhubon Costa, ExcelDemy

  5. Greetings UNSOLVABLE,
    We have just rechecked our code and it is working. You might have any compatibility issues for not working this code. You may download our sample Excel file and try to apply the code on that.

    Alternatively, you can share your Excel file on our forum https://exceldemy.com/forum/. We will solve your issues within no time.

    Best Regards,
    Bhubon Costa, Exceldemy

  6. Dear Nouran,

    I am delighted to hear that your previous queries have been resolved. It seems like you have invested a lot of patience and effort, considering you had to work with 18 variables to accomplish your task!

    Regarding your further queries, you want to send reminder emails multiple times with different time intervals. For instance, you want to send the first mail three days prior to the deadline, the second mail five days prior to the deadline, and the final mail seven days before the deadline. To accomplish this, we have utilized the following dataset, and as of today, it is the 8th of May, 2023.

    Now, you have to modify the If section of the codes as in the image below.

    Here, is the full updated code.

    Public Sub SendReminderMail_Multiple()
    'Declare Variables
        Dim XDueDate As Range
        Dim XRcptsEmail As Range
        Dim xMailContent As Range
        Dim xRngDn As Range
        Dim xCrtOut As Object
        Dim xValDateRng As String
        Dim xValSendRng As String
        Dim k As Long
        Dim xMailSections As Object
        Dim xFinalRw As Long
        Dim CrVbLf As String
        Dim xMsg As String
        Dim xSubEmail As String
        On Error Resume Next
        'To select the date column insert a input box
        Set XDueDate = Application.InputBox("Select the column for Deadline/Due Date date column:", "ExcelDemy", , , , , , 8)
        If XDueDate Is Nothing Then Exit Sub
        'Insert a input box for selecting the recipients
        Set XRcptsEmail = Application.InputBox("Choose the column for the email addresses of the recipients:", "ExcelDemy", , , , , , 8)
        If XRcptsEmail Is Nothing Then Exit Sub
        'To enter the text mail, insert a input box
        Set xMailContent = Application.InputBox("In your email, choose the column with the reminded text:", "ExcelDemy", , , , , , 8)
        If xMailContent Is Nothing Then Exit Sub
        'Count rows for the due dates
        xFinalRw = XDueDate.Rows.Count
        Set XDueDate = XDueDate(1)
        Set XRcptsEmail = XRcptsEmail(1)
        Set xMailContent = xMailContent(1)
        'Set command to open MS Outlook Application
        Set xCrtOut = CreateObject("Outlook.Application")
        
        'Apply For loop to conduct the operation in each row one by one
        For k = 1 To xFinalRw
            xValDateRng = ""
            xValDateRng = XDueDate.Offset(k - 1).Value
            'Apply If condition for the Due Date values
            
            If xValDateRng <> "" Then
                Dim xDaysDiff As Integer
                xDaysDiff = DateDiff("d", Date, CDate(xValDateRng))
                If xDaysDiff = 3 Or xDaysDiff = 5 Or xDaysDiff = 7 Then
                    xValSendRng = XRcptsEmail.Offset(k - 1).Value
                    
                    'Create the subject, body and text contents with the required variables
                    xSubEmail = xMailContent.Offset(k - 1).Value & " on " & xValDateRng
                    CrVbLf = "<br><br>"
                    xMsg = "<HTML><BODY>"
                    xMsg = xMsg & "Dear " & xValSendRng & CrVbLf
                    xMsg = xMsg & "Text : " & xMailContent.Offset(k - 1).Value & CrVbLf
                    xMsg = xMsg & "</BODY></HTML>"
                'Create the email
                Set xMailSections = xCrtOut.CreateItem(0)
                'Define the position to place the Subject, Body and Recipients Address
                With xMailSections
                    .Subject = xSubEmail
                    .To = xValSendRng
                    .HTMLBody = xMsg
                    .Display
                    
                    '.Send
                
                End With
                Set xMailSections = Nothing
            End If
        End If
        Next
        Set xCrtOut = Nothing
    End Sub

    I hope that this response has resolved your current queries. If you would like to automate the program, please refer to our previous replies for detailed instructions. Additionally, please inform us if you have any further questions.

    Regards,
    ExcelDemy Team

  7. Dear Nouran,

    I am delighted to hear that your previous queries have been resolved. It seems like you have invested a lot of patience and effort, considering you had to work with 18 variables to accomplish your task!

    Regarding your further queries, you want to send reminder emails multiple times with different time intervals. For instance, you want to send the first mail three days prior to the deadline, the second mail five days prior to the deadline, and the final mail seven days before the deadline. To accomplish this, we have utilized the following dataset, and as of today, it is the 8th of May, 2023.

    Now, you have to modify the If section of the codes as in the image below.

    Here, is the full updated code.

    Public Sub SendReminderMail_Multiple()
    'Declare Variables
        Dim XDueDate As Range
        Dim XRcptsEmail As Range
        Dim xMailContent As Range
        Dim xRngDn As Range
        Dim xCrtOut As Object
        Dim xValDateRng As String
        Dim xValSendRng As String
        Dim k As Long
        Dim xMailSections As Object
        Dim xFinalRw As Long
        Dim CrVbLf As String
        Dim xMsg As String
        Dim xSubEmail As String
        On Error Resume Next
        'To select the date column insert a input box
        Set XDueDate = Application.InputBox("Select the column for Deadline/Due Date date column:", "ExcelDemy", , , , , , 8)
        If XDueDate Is Nothing Then Exit Sub
        'Insert a input box for selecting the recipients
        Set XRcptsEmail = Application.InputBox("Choose the column for the email addresses of the recipients:", "ExcelDemy", , , , , , 8)
        If XRcptsEmail Is Nothing Then Exit Sub
        'To enter the text mail, insert a input box
        Set xMailContent = Application.InputBox("In your email, choose the column with the reminded text:", "ExcelDemy", , , , , , 8)
        If xMailContent Is Nothing Then Exit Sub
        'Count rows for the due dates
        xFinalRw = XDueDate.Rows.Count
        Set XDueDate = XDueDate(1)
        Set XRcptsEmail = XRcptsEmail(1)
        Set xMailContent = xMailContent(1)
        'Set command to open MS Outlook Application
        Set xCrtOut = CreateObject("Outlook.Application")
        
        'Apply For loop to conduct the operation in each row one by one
        For k = 1 To xFinalRw
            xValDateRng = ""
            xValDateRng = XDueDate.Offset(k - 1).Value
            'Apply If condition for the Due Date values
            
            If xValDateRng <> "" Then
                Dim xDaysDiff As Integer
                xDaysDiff = DateDiff("d", Date, CDate(xValDateRng))
                If xDaysDiff = 3 Or xDaysDiff = 5 Or xDaysDiff = 7 Then
                    xValSendRng = XRcptsEmail.Offset(k - 1).Value
                    
                    'Create the subject, body and text contents with the required variables
                    xSubEmail = xMailContent.Offset(k - 1).Value & " on " & xValDateRng
                    CrVbLf = "<br><br>"
                    xMsg = "<HTML><BODY>"
                    xMsg = xMsg & "Dear " & xValSendRng & CrVbLf
                    xMsg = xMsg & "Text : " & xMailContent.Offset(k - 1).Value & CrVbLf
                    xMsg = xMsg & "</BODY></HTML>"
                'Create the email
                Set xMailSections = xCrtOut.CreateItem(0)
                'Define the position to place the Subject, Body and Recipients Address
                With xMailSections
                    .Subject = xSubEmail
                    .To = xValSendRng
                    .HTMLBody = xMsg
                    .Display
                    
                    '.Send
                
                End With
                Set xMailSections = Nothing
            End If
        End If
        Next
        Set xCrtOut = Nothing
    End Sub

    I hope that this response has resolved your current queries. If you would like to automate the program, please refer to our previous replies for detailed instructions. Additionally, please inform us if you have any further questions.

    Regards,
    ExcelDemy Team

  8. Yes, you can still run the program when your Excel App is closed. You do not need to run the program every day manually. By doing so, whenever you open your PC your program will be executed automatically. Follow the steps below to do so.
    Step 1:

    1. From the Start Menu type Run to open the Windows Run dialog box and paste the following path:

    %AppData%\Microsoft\Windows\Start Menu\Programs\Startup

    2. Click OK.

    Step 2: Place your Excel File in the Startup folder.

    Step 3:

    1. Open your Excel file Macro Window.

    2. In the Project Explorer, double-click the ThisWorkbook object to open the code window for the workbook.

    3. In the code window, select Workbook from the drop-down list at the top.

    4. Then, select the Workbook_Open event from the drop-down list on the right.

    Step 4:

    1. Type or paste the VBA code that you want to run when the file is opened between the Private Sub Workbook_Open() and End Sub lines.

    2. Save the Excel file.

    Private Sub Workbook_Open()
        "Your Full VBA Codes"
    End Sub

    Now, whenever you open your PC, the VBA code you wrote will be automatically executed. Hope this will resolve your issue. Please let us know your further feedback, our ExcelDemy Team is always relentless to welcome your issues.

    Regards,
    ExcelDemy Team

  9. Answer 1: Let’s say you want to add one more column for the mail content portion. So, we have assigned VBA codes with one more variable xMailContent2

    Copy the codes below and apply them to your Module.

    Public Sub SendReminderMail()
    'Declare the variables
        Dim XDueDate As Range
        Dim XRcptsEmail As Range
        Dim xMailContent As Range
        Dim xMailContent2 As Range
        
        Dim xRngDn As Range
        Dim xCrtOut As Object
        Dim xValDateRng As String
        Dim xValSendRng As String
        Dim k As Long
        Dim xMailSections As Object
        Dim xFinalRw As Long
        Dim CrVbLf As String
        Dim xMsg As String
        Dim xSubEmail As String
        On Error Resume Next
        
        'To select the date column insert a input box
        Set XDueDate = Application.InputBox("Select the column for Deadline/Due Date date column:", "ExcelDemy", , , , , , 8)
        If XDueDate Is Nothing Then Exit Sub
        
        'Insert a input box for selecting the recipients
        Set XRcptsEmail = Application.InputBox("Choose the column for the email addresses of the recipients:", "ExcelDemy", , , , , , 8)
        If XRcptsEmail Is Nothing Then Exit Sub
        
        'To enter the text mail content 1, insert a input box
        Set xMailContent = Application.InputBox("In your email, choose the column with the reminded text:", "ExcelDemy", , , , , , 8)
        If xMailContent Is Nothing Then Exit Sub
        
        'To enter the text mail content 2, insert a input box
        Set xMailContent2 = Application.InputBox("In your email, choose the column with the reminded text:", "ExcelDemy", , , , , , 8)
        If xMailContent2 Is Nothing Then Exit Sub
        
        'Count rows for the due dates
        xFinalRw = XDueDate.Rows.Count
        Set XDueDate = XDueDate(1)
        Set XRcptsEmail = XRcptsEmail(1)
        Set xMailContent = xMailContent(1)
        Set xMailContent2 = xMailContent2(1)
        'Set command to open MS Outlook Application
        Set xCrtOut = CreateObject("Outlook.Application")
        
        'Apply For loop to conduct the operation in each row one by one
        For k = 1 To xFinalRw
            xValDateRng = ""
            xValDateRng = XDueDate.Offset(k - 1).Value
            'Apply If condition for the Due Date values
            If xValDateRng <> "" Then
            'Condition set to send mail if the difference between due dates and current date is greater than 1 and less than 7 days
            'Means 1 < X< 7, X = Due Date - Current Date
            If CDate(xValDateRng) - Date <= 7 And CDate(xValDateRng) - Date > 0 Then
                xValSendRng = XRcptsEmail.Offset(k - 1).Value
                'Create the subject, body and text contents with the required variables
                xSubEmail = xMailContent.Offset(k - 1).Value & " on " & xValDateRng
                CrVbLf = "<br><br>"
                xMsg = "<HTML><BODY>"
                xMsg = xMsg & "Dear " & xValSendRng & CrVbLf
                xMsg = xMsg & "Text : " & xMailContent.Offset(k - 1).Value & CrVbLf
                xMsg = xMsg & "Text : " & xMailContent2.Offset(k - 1).Value & CrVbLf
                xMsg = xMsg & "</BODY></HTML>"
                'Create the email
                Set xMailSections = xCrtOut.CreateItem(0)
                'Define the position to place the Subject, Body and Recipients Address
                With xMailSections
                    .Subject = xSubEmail
                    .To = xValSendRng
                    .HTMLBody = xMsg
                    .Display
                    
                    '.Send
                
                End With
                Set xMailSections = Nothing
            End If
        End If
        Next
        Set xCrtOut = Nothing
    End Sub

    See the output as images below:

    Answer 2: Unfortunately, you cannot run the program without opening the Excel App. You may get this done by applying API. However, you can try the below process but it has some troubleshooting issues. Please let us know if you get solved your issue.

    1. Open Excel and create a new workbook or open an existing one.
    2. Press Alt + F11 to open the Visual Basic Editor.
    3. Write your VBA code in a module.
    4. Save the workbook as a macro-enabled workbook (*.xlsm) format.
    5. Close Excel.
    6. Open the Task Scheduler by typing “Task Scheduler” in the Start menu search bar and pressing Enter.
    7. Click on “Create Task” in the right-hand panel.
    8. In the “General” tab, give the task a name and a description.
    9. In the “Actions” tab, click “New” and select “Start a program” as the action.
    10. In the “Program/script” field, browse to the location where your Excel workbook is saved and select it.
    11. In the “Add arguments” field, enter the full path and filename of the workbook you want to run, enclosed in quotes.
    12. Click “OK” to close the “New Action” dialog box.
    13. In the “Triggers” tab, click “New” and select the frequency and timing for the task to run.
    14. Click “OK” to close the “New Trigger” dialog box.
    15. Click “OK” to create the task.

    On the other hand, you can automatically run when you open the Excel file, you do not need to manually run the code. Simply, apply the VBA codes inside the Private Sub event.

    Private Sub Workbook_Open()
        "Your Full VBA Codes"
    End Sub
  10. You do not need to run the program every day manually. You can automatically run the program whenever you open your PC. Follow the steps below to do so.
    Step 1:

    1. From the Start Menu type Run to open the Windows Run dialog box and paste the following path:

    %AppData%\Microsoft\Windows\Start Menu\Programs\Startup

    2. Click OK.

    Step 2: Place your Excel File in the Startup folder.

    Step 3:

    1. Open your Excel file Macro Window.

    2. In the Project Explorer, double-click the ThisWorkbook object to open the code window for the workbook.

    3. In the code window, select Workbook from the drop-down list at the top.

    4. Then, select the Workbook_Open event from the drop-down list on the right.

    Step 4:

    1. Type or paste the VBA code that you want to run when the file is opened between the Private Sub Workbook_Open() and End Sub lines.

    2. Save the Excel file.

    Private Sub Workbook_Open()
        "Your Full VBA Codes"
    End Sub

    Now, whenever you open your PC, the VBA code you wrote will be automatically executed. Hope this will resolve your issue. Please let us know your further feedback, our ExcelDemy Team is always relentless to welcome your issues.

    Regards,
    ExcelDemy Team

  11. Yeah, YUKI, you are right. Your workbook need to be opened all the time to continue running this program. But, Problem arises when you turn off your pc the program will not run. So, you need to reopen the Excel file and run the program on daily basis.

    However, you can just open the Excel App. from your PC. Then it will run automatically. To do so, please insert your whole code in between Private Sub as below:

    Private Sub auto_open()
    "Your Codes"
    End Sub

    So, whenever you open the Excel App. the program will continue to run.

    On the other hand, if you want to run the program just after whenever you open PC. We need some time to make it for you. You may share your Excel file with us in [email protected]. Our dedicated ExcelDemy Team is trying to resolve your issue.

    Regards,
    ExcelDemy Team

  12. Answer 1: To add one or more columns for the mail content section, you must add variables. Let’s say you want to add one more column so we will add VBA codes with one more variable xMailContent2. So, your data set may look like the following image, one column with the task name, and another with the task details.
    So, apply the following VBA codes to perform your requirements.

    Public Sub SendReminderMail()
    'Declare the variables
        Dim XDueDate As Range
        Dim XRcptsEmail As Range
        Dim xMailContent As Range
        Dim xMailContent2 As Range
        
        Dim xRngDn As Range
        Dim xCrtOut As Object
        Dim xValDateRng As String
        Dim xValSendRng As String
        Dim k As Long
        Dim xMailSections As Object
        Dim xFinalRw As Long
        Dim CrVbLf As String
        Dim xMsg As String
        Dim xSubEmail As String
        On Error Resume Next
        
        'To select the date column insert a input box
        Set XDueDate = Application.InputBox("Select the column for Deadline/Due Date date column:", "ExcelDemy", , , , , , 8)
        If XDueDate Is Nothing Then Exit Sub
        
        'Insert a input box for selecting the recipients
        Set XRcptsEmail = Application.InputBox("Choose the column for the email addresses of the recipients:", "ExcelDemy", , , , , , 8)
        If XRcptsEmail Is Nothing Then Exit Sub
        
        'To enter the task Name, insert a input box
        Set xMailContent = Application.InputBox("In your email, choose the column with the Task Name:", "ExcelDemy", , , , , , 8)
        If xMailContent Is Nothing Then Exit Sub
        
        'To enter the task details, insert a input box
        Set xMailContent2 = Application.InputBox("In your email, choose the column with the Task Details:", "ExcelDemy", , , , , , 8)
        If xMailContent2 Is Nothing Then Exit Sub
        
        'Count rows for the due dates
        xFinalRw = XDueDate.Rows.Count
        Set XDueDate = XDueDate(1)
        Set XRcptsEmail = XRcptsEmail(1)
        Set xMailContent = xMailContent(1)
        Set xMailContent2 = xMailContent2(1)
        'Set command to open MS Outlook Application
        Set xCrtOut = CreateObject("Outlook.Application")
        
        'Apply For loop to conduct the operation in each row one by one
        For k = 1 To xFinalRw
            xValDateRng = ""
            xValDateRng = XDueDate.Offset(k - 1).Value
            'Apply If condition for the Due Date values
            If xValDateRng <> "" Then
            'Condition set to send mail if the difference between due dates and current date is greater than 1 and less than 7 days
            'Means 1 < X< 7, X = Due Date - Current Date
            If CDate(xValDateRng) - Date <= 7 And CDate(xValDateRng) - Date > 0 Then
                xValSendRng = XRcptsEmail.Offset(k - 1).Value
                'Create the subject, body and text contents with the required variables
                xSubEmail = xMailContent.Offset(k - 1).Value & " on " & xValDateRng
                CrVbLf = "<br><br>"
                xMsg = "<HTML><BODY>"
                xMsg = xMsg & "Dear " & xValSendRng & CrVbLf
                xMsg = xMsg & "Text : " & xMailContent.Offset(k - 1).Value & CrVbLf
                xMsg = xMsg & "Text : " & xMailContent2.Offset(k - 1).Value & CrVbLf
                xMsg = xMsg & "</BODY></HTML>"
                'Create the email
                Set xMailSections = xCrtOut.CreateItem(0)
                'Define the position to place the Subject, Body and Recipients Address
                With xMailSections
                    .Subject = xSubEmail
                    .To = xValSendRng
                    .HTMLBody = xMsg
                    .Display
                    
                    '.Send
                
                End With
                Set xMailSections = Nothing
            End If
        End If
        Next
        Set xCrtOut = Nothing
    End Sub

    Answer 2: You cannot run a file automatically from a Team Chanel server. However, you can automatically run the program whenever you open your PC. Follow the steps below to do so.
    Step 1:

    1. From the Start Menu type Run to open the Windows Run dialog box and paste the following path:

    %AppData%\Microsoft\Windows\Start Menu\Programs\Startup

    2. Click OK.

    Step 2: Place your Excel File in the Startup folder.

    Step 3:

    1. Open your Excel file Macro Window.

    2. In the Project Explorer, double-click the ThisWorkbook object to open the code window for the workbook.

    3. In the code window, select Workbook from the drop-down list at the top.

    4. Then, select the Workbook_Open event from the drop-down list on the right.

    Step 4:

    1. Type or paste the VBA code that you want to run when the file is opened between the Private Sub Workbook_Open() and End Sub lines.

    2. Save the Excel file.

    Private Sub Workbook_Open()
        "Your Full VBA Codes"
    End Sub

    Now, whenever you open your PC, the VBA code you wrote will be automatically executed. Hope this will resolve your issue. Please let us know your further feedback, our ExcelDemy Team is always relentless to welcome your issues.

    Regards,
    ExcelDemy Team

  13. Greeting Yuki,
    Thank you for your queries,

    This program will have to run just one time and when it will reach the due date it will send reminder emails automatically.

    But you can also customize it to send it manually. Please go through the “Notes” section in Step 3 of the article.

    You can stop sending emails automatically just by disabling the .Send command from the full code. It will pops up for a confirmation before sending. Moreover, you can customize the recipients names. That’s the elegance of our objective!

    However, if this doesn’t solve your queries, you can mail us your Excel file with detailed instructions to: [email protected], and we’ll try to solve it as soon as possible.

    Regards,
    ExcelDemy Team

  14. Greetings 3ADDOULA MA5ASSAK, thank you for your question. I hope the following codes will solve your issue.

     Sub Chemical_Formula()
        Dim inputString As String
        Dim i As Integer
        Dim Char As String
        Dim Text As String
        Dim Number As String
        Dim result As String
        
        inputString = InputBox("Enter the chemical formula:")
        result = ""
        Text = ""
        Number = ""
        
        For i = 1 To Len(inputString)
            Char = Mid(inputString, i, 1)
            If IsNumeric(Char) Then
                Number = Number & Char
            Else
                If Number <> "" Then
                    result = result & Text & "=" & Number & ","
                    Number = ""
                End If
                If Char Like "[A-Za-z]" Then
                    Text = Char
                End If
            End If
        Next i
    
        If Number <> "" Then
            result = result & Text & "=" & Number
        End If
    
        MsgBox result
    End Sub
     

    However, if this doesn’t solve your problem, you can mail us your Excel file with detailed instructions to: [email protected], and we’ll try to solve it as soon as possible.

  15. Greetings INSTASAVETUBE,
    Countless thanks for your kind words of praise. The Exceldemy team has always been there to assist and has been working to make knowledge accessible to everyone globally. And without a doubt, you are the kind of great people that empower us.

    Best Regards,
    Bhubon Costa
    (Exceldemy Team)

  16. Greetings Lalit,
    Pleased to hear that your previous query has been resolved.

    We have created an Excel file for you to add different subjects. Just download the file and run the code of Module 1.

    https://www.exceldemy.com/wp-content/uploads/2022/08/Send_Email_Reminder_Lalit.xlsm

    1. You will get an input box to select the subject column as shown in the image below.

    1

    2. Therefore, you will see the emails on display before sending them, with the selected different subjects.

    2

    Please feel free to ask more queries. Our ExcelDemy Team will reach you as soon as possible.

  17. Greetings Lalit,
    You just have to add two lines in between the xMailSections portion:
    Steps:
    1. Add the file path of your attachment with the attachment name.
    2. Apply add attachment command to add the attachment.

    Attached_File = "C:\Users\USER\Downloads\Send_Email_Reminder.xlsm"
    .Attachments.Add Attached_File

    Please, see the image below for a detailed understanding.

    1

    After running the code, you will see results with the attachment available.

    2

    Moreover, we have a dedicated article based on your requirement. Please, go through the article to learn in detail.

    Hope, this will meet your requirement. Please, give us feedback if any furthur query needed. The ExcelDemy team is always in your assistance.

  18. Greetings Emma,
    Let’s us know some info at first.
    1. Can you access the other methods to paste values only?
    2. Can you replace data in a non-blank cell?
    We have gone through every possible solution but couldn’t match the issue exactly. If you kindly share your excel file with us, we will send it back with the solution.
    Email: [email protected]
    Our dedicated ExcelDemy Team is always there to help.

  19. Greetings DANA,
    To update the result after each entry you make, you just need to edit a one-line VBA code. It will update the table range each time you make a new entry in column B.

    The VBA Code:

    Set TableRng = Range(Range("B5"), Range("B5").End(xlDown))

    Now, make new entries and run the program to update the result.
    Hope this will work for you. Please give us feedback if you have any further queries.

  20. Thanks a lot for your appreciation. You can also put your problems here, the ExcelDemy team is always in your assistance.

  21. Thank you MOE, for your generous appreciation!

  22. Greetings Justin,
    #VALUE error occurs when the function doesn’t find any recognized source value. It might have occurred if the degree values were not in degree formats. Follow the steps below to convert the value into degree format first and then apply the function Convert_to_Decimal with our VBA.

    Step 1:
    Add a degree (°) symbol after a number with a keyboard shortcut.

    Alt + 0176

    (Example: 32°).

    Step 2:
    Add a minute (‘) symbol after the minute’s value with the apostrophe (‘) key from the keyboard (Example: 16’).

    Step 3:
    Add a second (“) symbol after the second’s value by pressing

    SHIFT + Apostrophe (')

    (Example: 48″)

    Step 4:
    Your degree format will show like (32°16’48”).
    Finally, apply the Convert_to_Decimal function to the degree value.

    Hope this will work with your issue. You can also mail us the Excel file. We will provide the Excel file with the required solution. Please give us your further feedback.

  23. Greetings David,
    Thanks for your valuable suggestion.

  24. Greetings Nishant,
    To get emails one day prior the deadline date, try the following codes below.

    We just edited the code in the If condition by replacing 1 with 0.

    Previous code:

    If CDate(xValDateRng) - Date <= 7 And CDate(xValDateRng) - Date > 0 Then
                xValSendRng = XRcptsEmail.Offset(k - 1).Value

    Modified Code:

    If CDate(xValDateRng) - Date <= 7 And CDate(xValDateRng) - Date > 1 Then
                xValSendRng = XRcptsEmail.Offset(k - 1).Value

    Please, give us feedback, if any further query needed. The ExcelDemy team is always in your assistance.

  25. Greetings,
    According to your query, the ExcelDemy team has created an Excel file with the solution. Please provide your email address here, we will send it to you in no time.

    Otherwise, you can just follow the procedures as we have proceeded.

    Step 1:
    a. Our data set range is B4:F8.
    b. The names of the fruits range is C4:F4.
    c. Names of people range is B5:B8.

    Step 2:
    a. In cell C11, create a drop-down list with the range C4:F4.
    b. Give a named range for the numbers of each fruit with its name (Ex: Named range = Mango for C5:C8).
    c. Create another dropdown list dependant to the cell C11. Use the following formula in the Data Validation box from the Data tab to do this.

    =INDIRECT($C$11)

    Step 3:
    a. In cell C15, insert the following formula for Mango.

    =INDEX($B$5:$F$8,IF(IF($C$11=C4,MATCH(C4,$B$4:$F$4,0)," ")=(MATCH($C$11,$B$4:$F$4,0)),MATCH($D$11,C5:C8,0), " "),1)

    b. AutoFill the formula with dragging right for three cells for more three fruits.

    Step 4:
    a. Now, you are done, select any name (Grapes) from the first drop-down list.
    b. Then, select the number (6).
    c. It will result in the person name (Kent).

    Please, provide your further feedback if any queries needed.

  26. Greeting AIN,
    Let’s say you want to add another column containing the CC email addresses. You can just copy the codes from here. Moreover, if you want to get the Excel file containing the codes, just give your email address.

    Public Sub SendReminderMail()
    'Declare the variables
        Dim XDueDate As Range
        Dim XRcptsEmail As Range
        Dim xMailContent As Range
        Dim xRngDn As Range
        Dim xCrtOut As Object
        Dim xValDateRng As String
        Dim xValSendRng As String
        Dim k As Long
        Dim xMailSections As Object
        Dim xFinalRw As Long
        Dim CrVbLf As String
        Dim xMsg As String
        Dim xSubEmail As String
    'Declare variables for additional column
        Dim xCCEmail As String
        Dim xCCContent As Range
        
        On Error Resume Next
        
        'To select the date column insert a input box
        Set XDueDate = Application.InputBox("Select the column for Deadline/Due Date date column:", "ExcelDemy", , , , , , 8)
        If XDueDate Is Nothing Then Exit Sub
        
        'Insert a input box for selecting the recipients
        Set XRcptsEmail = Application.InputBox("Choose the column for the email addresses of the recipients:", "ExcelDemy", , , , , , 8)
        If XRcptsEmail Is Nothing Then Exit Sub
        
        'To enter the text mail, insert a input box
        Set xMailContent = Application.InputBox("In your email, choose the column with the reminded text:", "ExcelDemy", , , , , , 8)
        If xMailContent Is Nothing Then Exit Sub
        
        'To enter the CC mails in another column, insert a input box
        Set xCCContent = Application.InputBox("In your email, choose the column with the CC addresses:", "ExcelDemy", , , , , , 8)
        If xCCContent Is Nothing Then Exit Sub
        
        
        
        'Count rows for the due dates
        xFinalRw = XDueDate.Rows.Count
        Set XDueDate = XDueDate(1)
        Set XRcptsEmail = XRcptsEmail(1)
        Set xMailContent = xMailContent(1)
        Set xCCContent = xCCContent(1)
        
        'Set command to open MS Outlook Application
        Set xCrtOut = CreateObject("Outlook.Application")
        
        'Apply For loop to conduct the operation in each row one by one
        For k = 1 To xFinalRw
            xValDateRng = ""
            xValDateRng = XDueDate.Offset(k - 1).Value
            
            'Apply If condition for the Due Date values
            If xValDateRng <> "" Then
            
            'Condition set to send mail if the difference between due dates and current date is greater than 1 and less than 7 days
            'Means 1 < X< 7, X = Due Date - Current Date
            If CDate(xValDateRng) - Date <= 7 And CDate(xValDateRng) - Date > 0 Then
                xValSendRng = XRcptsEmail.Offset(k - 1).Value
                
                'Create the cc emails with the required variables
                xCCEmail = xCCContent.Offset(k - 1).Value
                
                'Create the subject, body and text contents with the required variables
                xSubEmail = xMailContent.Offset(k - 1).Value & " on " & xValDateRng
                
                CrVbLf = "<br><br>"
                xMsg = "<HTML><BODY>"
                xMsg = xMsg & "Dear " & xValSendRng & CrVbLf
                xMsg = xMsg & "Text : " & xMailContent.Offset(k - 1).Value & CrVbLf
                xMsg = xMsg & "</BODY></HTML>"
                
                'Create the email
                Set xMailSections = xCrtOut.CreateItem(0)
                
                'Define the position to place the Subject, Body and Recipients Address
                With xMailSections
                    .Subject = xSubEmail
                    .To = xValSendRng
                    .CC = xCCEmail
                    .HTMLBody = xMsg
                    .Display
                    
                    '.Send
                
                End With
                Set xMailSections = Nothing
            End If
        End If
        Next
        Set xCrtOut = Nothing
    End Sub
    
    

    Hope this will work with your requirements.
    Please, keep giving your feedbacks. The ExcelDemy team is always concerned about your queries.

  27. ‘Thank you Dan for your comment. Let’s just your first row is 2 and last row is 7.

    ‘First condition: G = “BID”, H <= 10000.00, I = "Orders, Web" OR ="cXML Orders"

    Sub Hide_Condition1()
    Dim i As Integer
        For i = 2 To 5
    ' Cells (i,7) here 7 means G column and i will be 2, so it will be G2 cell and so on
            If Cells(i, 7).Value = "BID" And Cells(i, 8).Value <= 10000 And _
            (Cells(i, 9).Value = "Orders, Web" Or Cells(i, 9).Value = "cXML Orders") Then
                Rows(i).EntireRow.Hidden = True
            Else
                Rows(i).EntireRow.Hidden = False
            End If
        Next i
    End Sub

    ‘Second condition: G =”MO”, H <10000.00

    Sub Hide_Condition_2()
    Dim i As Integer
        For i = 2 To 5
            If Cells(i, 7).Value = "MO" And Cells(i, 8).Value <= 10000 Then
    
                Rows(i).EntireRow.Hidden = True
            Else
                Rows(i).EntireRow.Hidden = False
            End If
        Next i
    End Sub

    ‘Last Condition: G <10000.00, Apply Color

    Sub Hide_Condition_3()
    Dim i As Integer
        For i = 2 To 5
            If Cells(i, 7).Value < 10000 Then
            Cells(i, 7).Interior.Color = RGB(253, 233, 217)
            End If
        Next i
    End Sub

    ‘Hope this answer your query.

  28. First of all, take cordial greetings from the ExcelDemy team. There could be some possible reasons due to the issue:
    The inverted commas are not properly inserted in your code as they should be in VBA script.
    The Sheet Names might not be inserted in VBA exactly as they are in the Excel file.
    However, we have created an Excel file precisely in accordance with your requirements. We can send the Excel file if you provide your email address.
    Otherwise, you can copy the codes below that we have used to make the Excel file with the right syntax. Please continue to provide us with feedback; ExcelDemy always welcomes your concerns.

    Sub MoveRowBasedOnCellValue()
    ‘Declare Variables
    Dim MAIN As Worksheet
    Dim Project As Worksheet
    Dim Claims As Worksheet
    Dim TaM As Worksheet
    Dim QUOTED As Worksheet
    Dim PM As Worksheet
    Dim FinalRow As Long
    Dim Cell As Range

    ‘Set Variables
    Set MAIN = Sheets(“Dataset2”)
    Set Claims = Sheets(“CLAIMS”)
    Set Project = Sheets(“Project”)
    Set TaM = Sheets(“TaM”)
    Set PM = Sheets(“PM”)
    Set QUOTED = Sheets(“QUOTED”)

    ‘Type a Command to select the entire row
    Selection.EntireRow.Select

    ‘Define destination sheets to move row
    FinalRow1 = MAIN.Range(“A” & MAIN.Rows.Count).End(xlUp).Row
    FinalRow2 = Claims.Range(“A” & Claims.Rows.Count).End(xlUp).Row
    FinalRow3 = Project.Range(“A” & Project.Rows.Count).End(xlUp).Row
    FinalRow4 = TaM.Range(“A” & TaM.Rows.Count).End(xlUp).Row
    FinalRow5 = QUOTED.Range(“A” & QUOTED.Rows.Count).End(xlUp).Row
    FinalRow6 = PM.Range(“A” & PM.Rows.Count).End(xlUp).Row
    With MAIN

    ‘Apply loop for column F until last cell with value
    For Each Cell In .Range(“F1:F” & .Cells(.Rows.Count, “F”).End(xlUp).Row)

    ‘Apply condition to match the “CLAIMS” value
    If Cell.Value = “CLAIMS” Then

    ‘Command to Copy and move to a destination Sheet “CLAIMS”
    .Rows(Cell.Row).Copy Destination:=Claims.Rows(FinalRow2 + 1)
    FinalRow2 = FinalRow2 + 1

    ‘Apply condition to match the “PROJECT” value
    ElseIf Cell.Value = “EQUIPMENT PROJECT” Then

    ‘Command to Copy and move to a destination Sheet “PROJECT”
    .Rows(Cell.Row).Copy Destination:=Project.Rows(FinalRow3 + 1)
    FinalRow3 = FinalRow3 + 1

    ‘Apply condition to match the “PROJECT” value
    ElseIf Cell.Value = “CONTRACTING PROJECT” Then

    ‘Command to Copy and move to a destination Sheet “PROJECT”
    .Rows(Cell.Row).Copy Destination:=Project.Rows(FinalRow3 + 1)
    FinalRow3 = FinalRow3 + 1

    ‘Apply condition to match the “TaM” value
    ElseIf Cell.Value = “T&M” Then

    ‘Command to Copy and move to a destination Sheet “TaM”
    .Rows(Cell.Row).Copy Destination:=TaM.Rows(FinalRow4 + 1)
    FinalRow4 = FinalRow4 + 1

    ‘Apply condition to match the “Quoted” value
    ElseIf Cell.Value = “QUOTED” Then

    ‘Command to Copy and move to a destination Sheet “QUOTED”
    .Rows(Cell.Row).Copy Destination:=QUOTED.Rows(FinalRow5 + 1)
    FinalRow5 = FinalRow5 + 1

    ‘Apply condition to match the “SVC AGR” value
    ElseIf Cell.Value = “SVC AGR” Then

    ‘Command to Copy and move to a destination Sheet “PM”
    .Rows(Cell.Row).Copy Destination:=PM.Rows(FinalRow6 + 1)
    FinalRow6 = FinalRow6 + 1
    End If

    Next Cell

    End With

    End Sub

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo