User Posts: Hadi Ul Bashar
Excel VBA to Concatenate Cell Values 

While working on Excel, sometimes we need to concatenate cell values. We can use Excel VBA to concatenate cell values easily. For example, if we have a dataset ...

Excel VBA Target Cell: 9 Practical Examples

Looking for ways to interact with a target cell using VBA in Excel? Then, this is the right place for you. If you want to interact with a cell in the ...

Excel VBA to Find Cell Address Based on Value (3 Examples)

If you frequently use Excel, you may have encountered scenarios where you needed the address of a cell that contained a specific value. For instance, we may ...

Excel VBA: Create InputBox with Multiple Inputs

Looking for ways to create an inputbox with multiple inputs using VBA in Excel? Then, this is the right place for you. Excel VBA InputBox is a built-in ...

Excel VBA Multidimensional Arrays 

If you’re thinking about storing multiple data against a common entry, a multidimensional array can serve the need. Multidimensional Arrays are arrays with ...

Excel MIN Function Returns 0: 2 Possible Scenarios

You may use Excel’s MIN function to get the minimum value from a range of cells. In some cases your Excel MIN function returns 0. In this article, I’m going to ...

Excel Data Validation for Date Format (4 Suitable Examples)

We use Excel in our day to day life. One important aspect while using Excel is that we need to use date and time every now and then. And you may have some ...

DMAX Method for Lactate Threshold in Excel

If you’re a fitness enthusiast or an expert, the possibility is that you may have heard about the Lactate threshold. The lactate threshold is an indicator of ...

How to Calculate Alpha in Excel (4 Suitable Examples)

If you’re ever interested in calculating the highest possible return from a minimum amount of investment risk, you’re in the right place. In this article, I’ll ...

Calculate Percentile from Mean and Standard Deviation in Excel

If you’re working on statistical data, you may require to calculate Percentile every now and then. There are several ways of calculating Percentiles. In this ...

How to Create Cost of Delay Calculator in Excel (with Easy Steps)

Business analysts frequently have to choose which goods or projects to prioritize. There is a trade-off between projects, particularly about which project one ...

How to Hide Filter Buttons in Excel

We often use Excel to maintain databases in our day-to-day life. In some cases, we need to filter our data based on specific conditions. This can be done ...

How to Use Excel VBA VLookup Within Loop

Have you ever spent hours manually matching data across multiple sheets or tables in Excel? The tedious and time-consuming task can leave you feeling ...

How to Create Pie Radar Chart in Excel

If you want to compare a set of data, Excel provides you with an option to compare in a smart way. Pie Radar Chart in Excel helps you to visualize your data ...

How to Ignore Blank Cells in Named Range in Excel

You may have seen many Excel Sheets with blank cells. Some of these blank cells may even exist under a Named Range. Excel in general doesn’t do anything on its ...

Browsing All Comments By: Hadi Ul Bashar
  1. Hello VIKASHINI,

    Thank you for explaining your issue in a concise way. Yes, it is possible to extract the whole sentence. You can apply the following steps for that:

    1. First of all, open your Word document.
    2. Go to Developer tab and select Visual Basic.
    3. Navigate to Insert tab and select Module.
    4. Type the following code in the module and press the F5 key to run the macro.

    Sub ExtractCommentsAndSentencesToExcel()
        Dim xApp As Excel.Application
        Set xApp = CreateObject("Excel.Application")
        xApp.Visible = True
        Dim xWB As Excel.Workbook
        Set xWB = xApp.Workbooks.Add
        Dim xWS As Excel.Worksheet
        Set xWS = xWB.Worksheets(1)
        xWS.Range("A1:B1").Value = Array("Sentence", "Comment")
        Dim rowNum As Integer
        rowNum = 2
        Dim doc As Document
        Set doc = ActiveDocument
        Dim cmnt As comment
        For Each cmnt In doc.Comments
            Dim sentenceText As String
            sentenceText = cmnt.Scope.Sentences(1).text
            xWS.Cells(rowNum, 1).Value = sentenceText
            xWS.Cells(rowNum, 2).Value = cmnt.Range.text
            rowNum = rowNum + 1
        Next cmnt
        Set xWS = Nothing
        Set xWB = Nothing
        Set xApp = Nothing
    End Sub

    Check the following images that contain the sample output.

    This is the output you will get in an Excel file.

    Please let me know if you have any further issues.
    Have a good day!

  2. Hello DEEP!

    From your comment, I think the most possible reason of the error could be inappropriate cell referencing. Please note that these formulas include both absolute and relative cell reference. You may copy paste the formulas, and then adjust the cell references according to your dataset. Hopefully that will solve your issue.

    solution of comment



    If you need further assistance regarding this, please feel free to send the Excel file in this email [email protected].

    Hadi Ul Bashar

Advanced Excel Exercises with Solutions PDF