I'm attempting to export this section of an excel sheet into a txt file. n_select determines how many rows have data and need to be exported. I've tried making a Range from n_select, but then it gives me a type mismatch error.
Private Sub Exporter_Click()
Dim n_personne As Integer
Dim n_select As String
Dim user As String
Dim fileName As String
n_personne = 1
user = Environ("username")
fileName = "Résultats Pêchés"
'DETERMINER LE NOMBRE DE RANGS DONNERS
Do Until IsEmpty(Worksheets("output").Cells(n_personne, 1).Value) = True
n_personne = n_personne + 1
Loop
'DETERMINER L'INTERVALLE A EXPORTER
n_select = "A1:" + Cells(n_personne, 5).Address(RowAbsolute:=False, ColumnAbsolute:=False)
Open "C:\Users\" + user + "\Desktop\" + fileName + ".txt" For Output As #1
Print #1, Range(n_select)
Close #1
Call Shell("Explorer.exe ""C:\Users\" + user + "\Desktop\" + fileName + ".txt")
End Sub