如何将对象作为Excel VBA中的引用传递给私有子?以下是我要做的事情:
Sub main()
Dim r As Range
Set r = Sheets("Sheet1").Range(Cells(1, 1), Cells(27, 27))
r.Select 'this works
select_cells (r) 'this doesn't work
End Sub
Private Sub select_cells(a As Range)
a.Select 'prompts Object Required error
End Sub
Run Code Online (Sandbox Code Playgroud)