Nombre incorrect d'arguments ou d'atsortingbution de propriété non valide dans VBA

Je reçois le message d'erreur de

Nombre incorrect d'arguments ou d'atsortingbution de propriété non valide

à cette ligne:

Set hello = Range("O" & row, "Q" & row, "W" & row) 

Cependant, la macro fonctionne en douceur avec Set hello = Range("O" & row) . Donc, cela signifie que cette macro est correcte avec la sélection d'une cellule, mais obtenant une erreur avec la sélection de plusieurs cellules. Je ne peux pas comprendre quel paramètre dans ma macro provoque cette erreur. Apprécier ton aide.

 Sub ImportDatafromotherworksheet() Dim wkbCrntWorkBook As Workbook Dim wkbSourceBook As Workbook Dim rngSourceRange As Range Dim rngDestination As Range Dim row As Integer Dim hello As Range Set wkbCrntWorkBook = ActiveWorkbook With Application.FileDialog(msoFileDialogOpen) .Filters.Clear .Filters.Add "Excel 2007-13", "*.xlsx; *.xlsm; *.xlsa" .AllowMultiSelect = False .Show If .SelectedItems.Count > 0 Then Workbooks.Open .SelectedItems(1) Set wkbSourceBook = ActiveWorkbook Set rngSourceRange = Application.InputBox(Prompt:="Select source row", Title:="Source Range", Default:="press Ctrl for multiple selection", Type:=8) row = rngSourceRange.row Set hello = Range("O" & row, "Q" & row, "W" & row) wkbCrntWorkBook.Activate Set rngDestination = Application.InputBox(Prompt:="Select destination cell", Title:="Select Destination", Default:="A1", Type:=8) hello.Copy rngDestination rngDestination.CurrentRegion.EntireColumn.AutoFit wkbSourceBook.Close False End If End With End Sub 

Ce que vous essayez de vous refind devrait être (par exemple) Range("O5,Q5,W5")

 Set hello = Range("O" & row & ",Q" & row & ",W" & row) 

Tout est une string, pas trois.

L'utilisation de .Union fonctionne également.

 Set hello = Application.Union(Range("O" & row), Range("Q" & row), Range("W" & row)) 

Je ne sais pas si c'est mieux que toute autre solution.