Excel VBA使用文件path从不同的工作表插入值
我想从不同的工作表中,包含“ – ”(连字符)在文件夹/文件名中的值,而不更改文件夹/文件的名称。 (想要使用文件path)
Sub file_path() Dim strFolder As String Dim CopySheet As String Dim po, iu As String Dim DestinationSheet As Variant Dim qwer As Workbook Dim poi As Workbook Dim por As Variant CopySheet = InputBox("path of workbook you recall") Set qwer = Workbooks.Open(CopySheet) po = InputBox("sheet name") iu = InputBox("Range") por = qewr.Sheets(po).Range(iu).Value ActiveCell.Value = vals po.Close End Sub
我尝试使用这个代码,但我不断收到错误,当我把“por”变体的值。 我怎样才能解决这个问题?