Glasgowsmile
Active Member
- Joined
- Apr 14, 2018
- Messages
- 280
- Office Version
- 365
- Platform
- Windows
Good day.
I am opening an older version of the same document, copying some data from it, and adding it to the new document.
I would like to use the sheet code name in the following line but when I do it comes back blank. What updates can I make?
If I use the sheet position then this works but I'd rather use something that isn't going to change.
Here is more of the code.
I am opening an older version of the same document, copying some data from it, and adding it to the new document.
I would like to use the sheet code name in the following line but when I do it comes back blank. What updates can I make?
If I use the sheet position then this works but I'd rather use something that isn't going to change.
VBA Code:
Sheet1.Range("B2:P2").Copy Sheet1.Range("B2")
Here is more of the code.
VBA Code:
Dim wkbCrntWorkBook As Workbook
Dim wkbSourceBook As Workbook
Dim ws As Worksheet
Set wkbCrntWorkBook = ActiveWorkbook
With Application.FileDialog(msoFileDialogOpen)
.Filters.Clear
.Filters.Add "Excel 2007-13", "*.xlsx; *.xls; *.xlsm; *.xlsa; *.csv"
.AllowMultiSelect = False
.Show
If .SelectedItems.Count > 0 Then
Workbooks.Open .SelectedItems(1)
Set wkbSourceBook = ActiveWorkbook
Set ws = wkbSourceBook.Sheets(1)
If Not SheetExists("Raw") Then
Sheet1.Range("B2:P2").Copy Sheet1.Range("B2")