ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   inserting rows and open file dialog (https://www.excelbanter.com/excel-programming/326883-inserting-rows-open-file-dialog.html)

[email protected]

inserting rows and open file dialog
 
is there any way to create a macro that can open a file and then count
the number of rows within that file (a csv) insert that amount of rows
into an existing spreadsheet (where cell is selected) and then copy the
contents into those new rows?

one of the problems is that it is not a specific file, so is there a
way to have the open file window appear aswell?


Thief_

inserting rows and open file dialog
 
In XL 2002,

Application.FindFile

This will open a browse-for-file dialog and then open it in a new wb

or
fileToOpen = Application _
.GetOpenFilename("Text Files (*.txt), *.txt")
If fileToOpen < False Then
MsgBox "Open " & fileToOpen
End IfYou should then open the CSV file, which will open as a new workbook,
and use VBA to perform whatever actions you like on it!

--
|
+--Thief_
|


wrote in message
oups.com...
is there any way to create a macro that can open a file and then count
the number of rows within that file (a csv) insert that amount of rows
into an existing spreadsheet (where cell is selected) and then copy the
contents into those new rows?

one of the problems is that it is not a specific file, so is there a
way to have the open file window appear aswell?





All times are GMT +1. The time now is 04:08 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com