Import Text Files into Excel at Cell D1 with VBA
Question details
The user wants a VBA procedure to place imported text file data in a new Excel worksheet starting at cell D1.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A VBA macro opens text files and copies their contents into newly created worksheets.
- Observed behavior
- The copied data starts at A1 instead of the desired destination, D1.
Locate the macro that creates the destination worksheet and copies the text file data. Confirm that TextFile refers to the opened text file workbook and NewSheet refers to the new destination worksheet.
Set the VBA copy destination to cell D1
Use this change when the macro copies data from the opened text file workbook into a newly created worksheet.
In Excel, open the workbook containing the macro, then select Developer > Visual Basic and find the procedure that imports the text files.
Replace the existing copy statement with: TextFile.Sheets(1).Range("A1").CurrentRegion.Copy Destination:=NewSheet.Range("D1").
Save the macro in a macro-enabled workbook, then run it from Developer > Macros. Open the newly created worksheet and check that the copied data starts at D1.

Work with spreadsheet data in WPS Office
WPS Office is a free, lightweight alternative with a familiar spreadsheet interface for opening and editing Microsoft Excel files. It can help you move between office suites, but it does not fix an Excel VBA macro; macro support and compatibility may vary.

Frequently Asked Questions
Why does the imported data start at A1?
The macro's copy or import operation is targeting A1, or another default starting cell. In the copy statement, set Destination:=NewSheet.Range("D1") to place the copied range at D1.
Does changing the destination alter the source text file?
No. The Copy statement reads the source range from TextFile.Sheets(1) and places a copy in NewSheet starting at D1; it does not change the source range.
What if CurrentRegion does not copy all the text data?
CurrentRegion stops at blank rows and columns around the region containing A1. Replace Range("A1").CurrentRegion with an explicit source range that covers the required data.
How do I keep the VBA macro when I save the workbook?
Use File > Save As and choose Excel Macro-Enabled Workbook (.xlsm). Saving as an .xlsx file does not retain VBA macros.




