Import textfile to first free cell in row and use right formating

SalK

New Member
Joined
Oct 2, 2009
Messages
2
Hello

Hopefully you can help me with this. I have tried several VBA modules made by others but I havent got it 100% right yet. Here is what I want to do.

I want to import a textfile into a sheet that already contains a lot of info.

I want to find the last cell in A row and there import my textfile.

It also needs to use the right format since the textfile data is separated with tabs.

It also needs to be sorted by the data in the first row.

The data in the textfile will have different numbers of rows but not collumns.

Thanks in advance! /SalK
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
51,416
Office Version
365
Platform
Windows
Welcome to the Board!

Check out this link here for finding the last row (if you do a Search, you will come across tons of posts that deal with this question):
http://www.mrexcel.com/forum/showthread.php?t=408192&highlight=find+row

A useful thing to select a whole block of data when you don't know the size of it is to use Current Region, which will select all contiguous rows and columns from a determined starting point, i.e.
Range("A10").CurrentRegion.Select

Most of the other code that you will need you can get by using the Macro Recorder and record yourself recording the steps you want to complete.
 

SalK

New Member
Joined
Oct 2, 2009
Messages
2
Thanks for the help.

CurrentRegion.Select was useful and I inserted a blank row between imports and in that way I could use your tips.

/SalK
 

Forum statistics

Threads
1,081,545
Messages
5,359,444
Members
400,528
Latest member
Ratish52

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top