Bonjour,
En débutant sur Visual Basic, je suis confronté au problème suivant :
Je souhaite faire passer une variable de type Range.
Ex :
Dim CellsNumber As Integer
Dim LocationCell As String
Set myRange = Sheets(1).Range("A:A")
CellsNumber = Application.WorksheetFunction.CountA(myRange)
LocationCell = "A" & CellsNumber
Range(LocationCell).Select
With Sheets(1).QueryTables.Add(Connection:= _
"TEXT;" & "C:\Temp\ & "Toto.txt", Destination:=Range(LocationCell).Select)
L'utilisation de "Range(LocationCell).Select ne fonctionne pas.
Par contre l'utilisation de "TEXT;" & "C:\Temp\ & "Toto.txt", Destination:=Range("A2")) fonctionne.
Comment dois-je utiliser cette fonction correctement ?
Merci d'avance de votre aide et de votre indulgence.😕
En débutant sur Visual Basic, je suis confronté au problème suivant :
Je souhaite faire passer une variable de type Range.
Ex :
Dim CellsNumber As Integer
Dim LocationCell As String
Set myRange = Sheets(1).Range("A:A")
CellsNumber = Application.WorksheetFunction.CountA(myRange)
LocationCell = "A" & CellsNumber
Range(LocationCell).Select
With Sheets(1).QueryTables.Add(Connection:= _
"TEXT;" & "C:\Temp\ & "Toto.txt", Destination:=Range(LocationCell).Select)
L'utilisation de "Range(LocationCell).Select ne fonctionne pas.
Par contre l'utilisation de "TEXT;" & "C:\Temp\ & "Toto.txt", Destination:=Range("A2")) fonctionne.
Comment dois-je utiliser cette fonction correctement ?
Merci d'avance de votre aide et de votre indulgence.😕