Here's a start:
Private Sub CommandButton1_Click() Dim z, YourFile As String YourFile = "C:\yourchoice.csv" With GetObject(YourFile).Sheets(1) z = .Range(.Cells(1, 1), .Cells(1, .Cells(1, .Columns.Count).End(xlToLeft).Column)) .Parent.Close End With End Sub