I am working on a simple VBA code for several templates, all with the same structure. From these templates (name: "Workbook1" e.g.), from "Profile" worksheet I would like to copy several cells: F6-F11, D15, F15, H15 and K30-38 to another workbook ("Tracker", "Sheet1) always to the first free row starting from C2 then C3 and so on. Could you please help me with that? I have the code for opening the given file:
Option Explicit
Public Sub CopyData()
Dim wb As Workbook
Dim FileName As String
With Application.FileDialog(msoFileDialogOpen)
.AllowMultiSelect = False
If .Show Then
FileName = .SelectedItems(1)
Set wb = Workbooks.Open(FileName:=FileName)
Workbooks("Workbook1").Worksheets("Profile").Range("F6:F11").Copy
Workbooks("Tracker.xlsx").Worksheets("Sheet1").Range("C2").PasteSpecial Transpose:=True
wb.Close SaveChanges:=False
Set wb = Nothing
End If
End With
End Sub