Mehedi Hasan Shimul

About author

Hi! I am Mehedi Hasan Shimul. As I am an Engineer solving different problems with the help of Excel amuses me. I write Excel related different problem solving articles here. Hope it will help you.

Latest Posts From Mehedi Hasan Shimul

Bookkeeping for Truck Drivers in Excel

In this article, we explore how to make bookkeeping for truck drivers in Excel to track income, expenses, and mileage, as well as generate reports and ...

Excel Evaluate String as Formula (2 Easy Ways)

In this article, we will explore the idea to evaluate a string as a formula in Microsoft Excel. The necessity of this feature is discussed, especially in ...

How to Calculate Inverse Matrix in Excel (3 Ways)

This article will show you various techniques to calculate the inverse matrix in Excel. The Inverse Matrix calculation is a fundamental linear algebraic ...

Excel SUMIF Function for Not Equal Criteria

In this article, we will know how to use Excel SUMIF not equal criteria. Excel's SUMIF function is a strong tool for computing sums based on predetermined ...

How to Create Dynamic Table in Excel

Dynamic Tables in Excel provide a revolutionary method for effective data management. Dynamic tables reduce the need for manual updates and resizing by ...

How to Make a Bill of Materials in Excel (2 Types)

An effective and practical way to handle the materials, parts, and components needed for manufacturing or assembly operations is to create a Bill of Materials ...

Excel Scientific Notation Without e (7 Quick Tricks)

This article explores methods to convert Excel scientific notation without e to regular numbers. Scientific notation, often denoted with the "e" exponent ...

How to Use Excel VBA to Create Pivot Table (3 Examples)

In this article, we'll show you how to use Excel VBA to create a Pivot Table. Excel pivot tables are a valuable tool for data analysis, but manually creating ...

How to Call Private Sub in Excel VBA (4 Simple Ways)

Visual Basic for Applications (VBA) is a programming language commonly used in Microsoft Excel, Word, and other Office applications. Calling a Sub or Private ...

How to Run Excel VBA Do While Loop Till Cell Is Not Empty

VBA loops are an essential tool for automating data manipulation tasks in Excel. They allow you to repeat a set of instructions multiple times, saving you time ...

Excel VBA Error Handling in Loop (5 Best Practices)

VBA (Visual Basic for Applications) is a powerful tool that allows developers to create complex macros and automate various tasks in Microsoft Excel. However, ...

Excel VBA to List Files in Folder with Specific Extension 

Sometimes we need to list files with specific extensions in the Excel worksheets. Obviously, we can do it manually, but it’s quite laborious and ...

How to Use Excel VBA Target Range (4 Suitable Examples)

When we work in Excel, sometimes we need to run events when selecting a cell from a specific range that is known as the target address. It’s quite simple to ...

How to Create Slicer Drop Down in Excel (with Quick Steps)

Excel slicer drop-down is a powerful data filtering tool in Microsoft Excel that allows users to easily filter data in pivot tables and charts. It provides a ...

Export Folder Structure to Excel (3 Suitable Ways)

In today's digital age, businesses are increasingly relying on technology to streamline their operations. One important aspect of this is the organization and ...

Browsing All Comments By: Mehedi Hasan Shimul
  1. Reply Avatar photo
    Mehedi Hasan Shimul Jun 4, 2023 at 4:01 PM

    Thank you for your queries. Let’s change the code a bit. Use the following code to copy the data and paste it as values.

    Sub CopyWorksheetsToNewWorkbook()
        Dim srcWorkbook As Workbook
        Dim newWorkbook As Workbook
        Dim srcWorksheet As Worksheet
        Dim newWorksheet As Worksheet
        ' Set the source workbook
        Set srcWorkbook = ThisWorkbook
        ' Create a new workbook
        Set newWorkbook = Workbooks.Add
        ' Loop through each worksheet in the source workbook
        For Each srcWorksheet In srcWorkbook.Worksheets
            ' Copy only values to the new workbook
            srcWorksheet.UsedRange.Value = srcWorksheet.UsedRange.Value
            ' Copy the data to the new workbook
            srcWorksheet.Copy After:=newWorkbook.Sheets(newWorkbook.Sheets.Count)
            Set newWorksheet = newWorkbook.Sheets(newWorkbook.Sheets.Count)
            newWorksheet.Name = srcWorksheet.Name
            newWorksheet.Cells.PasteSpecial xlPasteValues
            Application.CutCopyMode = False
        Next srcWorksheet
        ' Save and close the new workbook
        ' Replace "C:\Path\To\Save\NewWorkbook.xlsx" with your desired file path and name
        newWorkbook.SaveAs "C:\ExcelDemy\NewWorkbook.xlsx"
        ' Clean up
        Set newWorksheet = Nothing
        Set newWorkbook = Nothing
        Set srcWorksheet = Nothing
        Set srcWorkbook = Nothing
    End Sub

    Afterward, you will see result like this.

    Copy Multiple Sheets to New Workbook as values with VBA - Excel

  2. Reply Avatar photo
    Mehedi Hasan Shimul Jun 4, 2023 at 3:36 PM
    • Hi PRANEETH!

    Thank you so much for your observation. We will rectify and update this error soon. Thanks again for your concern.

  3. Reply Avatar photo
    Mehedi Hasan Shimul Jun 4, 2023 at 3:24 PM

    Hi MIGUEL,

    We are glad, you asked the questions. It’s quite easy to import data from separate sheets and save it as separate documents. Simply, use the following code in a new module of VBA. Only, you have to change the file directory to save the doc file.

    Sub ExportWorksheetsToWord()
    Dim objWord As Object
    Dim objDoc As Object
    Dim objRange As Object
    Dim ws As Worksheet
    ' Create a new instance of Microsoft Word
    Set objWord = CreateObject("Word.Application")
    ' Make Word visible (optional)
    objWord.Visible = True
    ' Loop through each worksheet in the workbook
    For Each ws In ThisWorkbook.Worksheets
    ' Create a new Word document for each worksheet
    Set objDoc = objWord.Documents.Add
    ' Reference the range of the current worksheet
    Set objRange = ws.UsedRange
    ' Copy the range to the Clipboard
    ' Paste the range into the Word document
    objDoc.Range.PasteExcelTable LinkedToExcel:=False, WordFormatting:=False, RTF:=False
    ' Save the Word document with the worksheet name
    objDoc.SaveAs "C:\ExcelDemy\" & ws.Name & ".docx" ' Replace with your desired file path
    ' Close the Word document
    ' Clean up
    Set objDoc = Nothing
    Next ws
    ' Close Microsoft Word
    ' Clean up
    Set objWord = Nothing
    Set objRange = Nothing
    End Sub

    After running the code, you will see the doc files created according to your dataset.

    output seperate doc files for each worksheet data

  4. Reply Avatar photo
    Mehedi Hasan Shimul May 28, 2023 at 3:02 PM

    Hi Anna!

    You wanted to say what will happen if we input the same word with Upper and Lower case. The fact is Excel counts Upper and Lower case characters as the same. So you won’t have any issues. Even then I am showing one way to make your data to proper format first. Then, use the formatted text in the required formula.

    • Just use the following formula to make words with a proper case.


    proper case excel

    • Afterward, use the regular formula shown in the article.

    using formula for proper case text

Advanced Excel Exercises with Solutions PDF