luckyduck03
New Member
- Joined
- Aug 27, 2020
- Messages
- 4
- Office Version
- 2013
- Platform
- Windows
I've got this code from another post on this forum that takes data from a closed workbook and copies it to sheet 5 of current workbook, using range A5:F14,:
I'm trying to modify the code to copy a specified range from Closed Workbook.xlsm into sheet 5 of the current workbook, using the next empty row(I'm using Column E to determine the next empty row), below is what I have so far, but this places the value "='C:\[BAH BOM.xlsm]MATLIST.XLS'!$A$5:$F$14" into the next empty row of Column E, I'm trying to get this to grab data in cells A5:F14 from Closed Workbook.xlsm and pasts it into the same columns of A through F, while using Column E to determine the next empty row.
Any help is much appreciated.
Mark
Office 2013
VBA Code:
Sub AddDataRangeFromClosedWorkbook()
Dim mydata As String
mydata = "='C:\[Closed Workbook.xlsm]MATLIST.XLS'!$A$5:$F$14" '
With ThisWorkbook.Sheets(5).Range("A5:F14")
.Formula = mydata
.Value = .Value
End With
End Sub
I'm trying to modify the code to copy a specified range from Closed Workbook.xlsm into sheet 5 of the current workbook, using the next empty row(I'm using Column E to determine the next empty row), below is what I have so far, but this places the value "='C:\[BAH BOM.xlsm]MATLIST.XLS'!$A$5:$F$14" into the next empty row of Column E, I'm trying to get this to grab data in cells A5:F14 from Closed Workbook.xlsm and pasts it into the same columns of A through F, while using Column E to determine the next empty row.
VBA Code:
Sub AddDataRangeFromClosedWorkbook()
Dim mydata As String
mydata = "='C:\[Closed Workbook.xlsm]MATLIST.XLS'!$A$5:$F$14" '
With ThisWorkbook.Sheets(5).Range("E" & Rows.Count).End(xlUp).Offset(1)
.Formula = mydata
.Value = .Value
End With
End Sub
Any help is much appreciated.
Mark
Office 2013