Sishir Roy

About author

Sishir Roy, a recent graduate in Civil Engineering from Bangladesh University of Engineering and Technology, has dedicated over a year to the ExcelDemy project. As an Excel and VBA Content Developer, he has authored 50+ articles, updated 100+, and solved complex Excel VBA challenges. Excelling in troubleshooting and simplifying problems, his love for diverse problem-solving and aiding others is evident in his keen interests in Data Analysis, Advanced Excel, VBA Macro, and Excel Power Query, enriching the project's dynamic environment.

Designation

Excel & VBA Content Developer at ExcelDemy in SOFTEKO.

Lives in

Dhaka, Bangladesh.

Education

B.sc in Civil Engineering, Bangladesh University of Engineering and Technology.

Expertise

Visual Basic for Applications (VBA), Data Analysis, Data Management, Content Writing, Charts and Dashboards, Google Apps Script, C++, Microsoft Office, AutoCAD, SketchUp, ETABS, CSi SAP2000, MATLAB.

Experience

  • Excel & VBA Content Developer at Softeko, Bangladesh.
    • Resolved complex Excel and VBA challenges with innovative solutions.
    • Published 50+ articles and updated 100+ articles on ExcelDemy via WordPress.
    • Developed custom Excel templates with VBA and intricate formulas.
    • Designed a VBA-based data entry form for streamlined data management.
    • Applied research skills to troubleshoot intricate Excel issues systematically.
    • Engaged in daily online research to stay current with the latest developments.
  • Undergrad Project: Design of Water Supply, Sanitation & Sewerage Systems for Textile Industrial Village.
  • Undergrad Thesis: Quantifying High Resolution Intra-Urban Spatial Variability of Fine Particulate Matter across Dhaka City.

Summary

  • Currently working as an Excel & VBA Content Developer.
  • Started technical content writing of Excel & VBA for ExcelDemy in March 2023.
  • Started technical content writing of Google Sheets for OfficWheel in November 2022.

Latest Posts From Sishir Roy

0
Burndown Chart in Excel (Create & Customize)

In this article, you'll learn about burndown charts in Excel to simplify project management. This article will go through a step-by-step process of how to ...

0
How to Calculate Subtotals in Excel? (A Complete Guide)

In this Excel tutorial, you'll learn how to insert subtotals in a list of data in a worksheet by using Excel's built-in Subtotal feature and the SUBTOTAL ...

0
Compatibility Mode in Excel (Find, Check, Save, and Turn Off)

In this Excel tutorial, you'll learn the essential features regarding the compatibility mode in Excel. You will learn how to save a document, check its ...

0
Fraction in Excel (Write, Display and Convert)

In this article, you'll learn everything one should know about fractions in Excel. This article covers how to write fractions, convert them, and format them in ...

0
How to Work with Rows Using VBA in Excel (Ultimate Guide)

The VBA Rows property returns rows within a range or worksheet in Excel. This property is useful for manipulating or interacting with rows in Excel through VBA ...

0
How to Convert Numbers Stored as “Text” to Numbers in Excel

Sometimes numbers in Excel may not work correctly during calculations if they're mistakenly formatted as text. Even though Excel usually converts numerical ...

Browsing All Comments By: Sishir Roy
  1. Hello ANDRES,
    Thank you for reaching out to us. It appears that you want to store the username (which is the first column) and only the numeric values in your Excel file from your text file.
    To achieve this, you can use the following code:

    Sub Import_Selected_Data_To_Excel()
        Dim importFileNum As Integer, rowNumber As Integer, columnNumber As Integer
        Dim importFileLocation As String, textDelimiter As String, textData As String
        Dim textArray() As String, splitArray() As String, outputData As String
    
        importFileLocation = Application.GetOpenFilename()
    
        textDelimiter = ","
    
        importFileNum = FreeFile
        Open importFileLocation For Input As importFileNum
    
        textData = Input(LOF(importFileNum), importFileNum)
    
        Close importFileNum
    
        textArray() = Split(textData, vbLf)
    
        For rowNumber = LBound(textArray) To UBound(textArray) - 1
            If Len(Trim(textArray(rowNumber))) <> 0 Then
                splitArray = Split(textArray(rowNumber), textDelimiter)
                If UBound(splitArray) >= 1 Then
                    outputData = outputData & splitArray(0)
                    For columnNumber = 1 To UBound(splitArray)
                        If IsNumeric(splitArray(columnNumber)) Then outputData = outputData & vbTab & splitArray(columnNumber)
                    Next columnNumber
                    outputData = outputData & vbCrLf
                End If
            End If
        Next rowNumber
    
        If Len(outputData) > 0 Then
            outputData = Left(outputData, Len(outputData) - 2)
            ActiveSheet.Cells.Clear
    
            Dim dataArray() As String, rowArray() As String
            dataArray = Split(outputData, vbCrLf)
            
            For rowNumber = 1 To UBound(dataArray) + 1
                rowArray = Split(dataArray(rowNumber - 1), vbTab)
                For columnNumber = 1 To UBound(rowArray) + 1
                    ActiveSheet.Cells(rowNumber, columnNumber).Value = rowArray(columnNumber - 1)
                Next columnNumber
            Next rowNumber
            
            MsgBox "Data Imported Successfully", vbInformation
        Else
            MsgBox "No Data Has Been Found", vbExclamation
        End If
    End Sub

    This code will import multiple rows of data with the username and numeric values from your text file into Excel.

    For demonstration, I have created a text file like the image below:

    text file

    After running the code and choosing the text file, you will get an output like this:

    output of Excel file

    Let me know if you have any questions or if there’s anything else I can help you with!

    Regards,
    Sishir Roy

  2. Yes REL. You’re correct. The potential issue in the code lies in the line: Worksheets(i).SaveAs Filename:=Full_Name This line of code saves the entire workbook, not just the individual sheet. As a result, when you open the saved files, you see all the tabs because you saved the entire workbook, not just the specific sheet.

    If you want to save each sheet of your current workbook as a separate file and not the entire workbook, you can use the following code:

    Sub Save_All_Worksheets_as_New_Files()
        Dim File_Dialog As FileDialog
        Dim i As Integer
        Dim NewWorkbook As Workbook
        Dim Full_Name As String
    
        Set File_Dialog = Application.FileDialog(msoFileDialogFolderPicker)
        File_Dialog.AllowMultiSelect = False
        File_Dialog.Title = "Select the Directory to Save the File"
    
        If File_Dialog.Show <> -1 Then
            Exit Sub
        End If
    
        For i = 1 To Sheets.Count
            Set NewWorkbook = Workbooks.Add
            ThisWorkbook.Sheets(i).Copy = NewWorkbook.Sheets(1)
    
            Full_Name = File_Dialog.SelectedItems(1) & "\" & ThisWorkbook.Sheets(i).Name
            NewWorkbook.SaveAs Filename:=Full_Name
    
            NewWorkbook.Close SaveChanges:=False
        Next i
    End Sub
    
  3. Hello LILY,
    The formula used in the section “How to Include Space Between Numbers and Text in Excel” is a complex formula designed to insert a space after the rightmost numeric sequence in the text in a cell and then trim any extra spaces. It does not insert a space before the numeric sequence and only inserts a space after the rightmost numeric sequence. For example, you can see the image below.

    The issue you are facing might be due to certain functions not working correctly in your Excel version. Consider using the latest version to avoid these problems.
    However, the formula in the provided section does not insert space before the numeric sequence, making it less versatile. If you wish to insert a space between text and numbers regardless of the order of the numeric sequence, I can provide you with a VBA code to address this. If you want to insert a space before and after each numeric sequence without spaces between individual digits, you can use the following VBA function:

    Function InsertSpacesAroundNumbers(inputText As String) As String
        Dim outputText As String
        Dim i As Integer
        Dim num As String
        Dim insideNumericSequence As Boolean
    
        outputText = ""
        insideNumericSequence = False
    
        For i = 1 To Len(inputText)
            num = Mid(inputText, i, 1)
    
            If IsNumeric(num) Then
                If Not insideNumericSequence Then
                    outputText = outputText & " "
                    insideNumericSequence = True
                End If
                outputText = outputText & num
            Else
                If insideNumericSequence Then
                    outputText = outputText & " "
                    insideNumericSequence = False
                End If
                outputText = outputText & num
            End If
        Next i
    
        outputText = Trim(outputText)
    
        Do While InStr(outputText, "  ") > 0
            outputText = Replace(outputText, "  ", " ")
        Loop
    
        outputText = Trim(outputText)
        InsertSpacesAroundNumbers = outputText
    End Function

    To use this, open the VBA launcher by pressing the Alt+F11 button on your keyboard.
    Click on the Insert button and choose the Module option.
    In the Module section, paste the provided VBA code.

    After that, go back to your Excel file, and type the function name ‘=InsertSpacesAroundNumbers‘. You will find the function name in the function list. Put the cell reference in the function argument and press Enter.

    As a result, it will insert a space before and after each numeric sequence without inserting spaces between individual digits.

    Regards,
    Sishir Roy

  4. Hi BISMARK,
    The provided code can be executed multiple times. Each time you run the subroutine, it refreshes the data of a closed Excel file without manually opening it.
    The code does not alter or have any impact on the Excel file where the macro is located. The macro’s file doesn’t change. The code opens the separate Excel file indicated by the FilePath variable, then updates the links in that file before closing it. The actions are performed on the opened file, not the file where the macro code is located.
    It’s important to remember that if the macro is kept in the same workbook as the file you need to edit, you may modify the code to refer to the current workbook rather than using a distinct FilePath variable.
    Best Regards,
    Sishir Roy

  5. Hello ANNAWHO,
    The workbook (the one that is indicated by the ‘FilePath’) that is opened and changed with new data will be saved before it is closed in the supplied code of this article. The line “ActiveWorkbook.Close True” indicates that the file will be saved with any changes made to it before closing.
    However, the workbook containing the VBA code itself, the file where the macro resides, will not be saved as a result of running this code. The workbook that contains the code isn’t saved by the code itself.

    Best Regards,
    Sishir Roy

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo