as1989
as1989

Reputation: 1

vba - select first worksheet in a csv file

I am trying to write a macro that pastes some data into a large number of csv files saved in a folder. How do I get the macro to select the first worksheet in each csv file (csv files only have one worksheet)? If it was an Excel file I could do this:

Sheets("Sheet1").Select

However, each csv file has a different name for the worksheet.

Upvotes: 0

Views: 2646

Answers (1)

Mathieu Guindon
Mathieu Guindon

Reputation: 71227

Refer to it by its index instead of by name:

Sheets(1).Select

Upvotes: 3

Related Questions