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.
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 ...
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 ...
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 ...
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 ...
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 ...
Sometimes numbers in Excel may not work correctly during calculations if they're mistakenly formatted as text. Even though Excel usually converts numerical ...
ExcelDemy is a place where you can learn Excel, and get solutions to your Excel & Excel VBA-related problems, Data Analysis with Excel, etc. We provide tips, how to guide, provide online training, and also provide Excel solutions to your business problems.
Contact | Privacy Policy | TOS
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:
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:
After running the code and choosing the text file, you will get an output like this:
Let me know if you have any questions or if there’s anything else I can help you with!
Regards,
Sishir Roy
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:
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:
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
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
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