Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Add imported text to the first free row

0

Hi,

I was watching the Automated Text Import in Excel with File Selection - The Easy Way - VBA video tutorial and found it very helpfull. Now I am trying to add the next import at the end of the first import, so at the next free row.

The VBA states 

"wbTextImport.Worksheets(1).Range("A1").CurrentRegion.Copy wsMaster.Range("A3")" which will replace the initial text instead of appending. I have found someting like

"Range("A" & Rows.Count).End(x1Down).Offset(1).Select.PasteSpecial" but I don't knwo how to combine it with the previuos one.

Any help is appreciated.

Thanks

Excelsior

Answer
Discuss

Answers

0
Selected Answer

Hi Excelsior and welcome to the Forum.

Your "something like" statement is a bit muddled up but this should do what you want:

wbTextImport.Worksheets(1).Range("A1").CurrentRegion.Copy wsMaster.Range("A" & Range("A" & Rows.Count).End(xlUp).Row).Offset(1,0)
where the bit in bold makes the paste address the last used cell of column A in the wsMaster worksheet but offset by 1 row (down) and 0 columns (right- for completeness).

Hope this makes sense/ fixes your problem.

Discuss


Answer the Question

You must create an account to use the forum. Create an Account or Login