Sub SheetBuilderV2()
' SheetBuilderV2 Macro
Dim WB As Workbook
Set WB = ThisWorkbook
Dim InitialRange As Range ' creates a range and sets it to be the selected cell
Set InitialRange = Selection
Dim NSName As String ' creates a string and sets it to be the selected cell, note that Set isn't required as this is a string data type, not an object
NSName = Selection.Value
Dim NS As Worksheet ' creates a worksheet variable, "NS"
Sheets.Add.Name = NSName
ActiveSheet.Move After:=Sheets(Sheets.Count) ' adds a new worksheet, after the last worksheet
Set NS = ActiveSheet ' sets the worksheet NS to be the activesheet, which should be the newly created worksheet
NS.Select
Sheets("Master List").Select ' the next 28 lines are pretty much just the copying and pasting of the sheet formatting into the new sheet
Range("A1:B1").Select
Application.CutCopyMode = False
Selection.Copy
NS.Select
ActiveSheet.Paste
Sheets("Master List").Select
Range("J3:J4").Select
Application.CutCopyMode = False
Selection.Copy
NS.Select
Range("A4").Select
ActiveSheet.Paste
Sheets("Master List").Select
Range("J7:M7").Select
Application.CutCopyMode = False
Selection.Copy
NS.Select
Range("A9").Select
ActiveSheet.Paste
Sheets("Master List").Select
Dim CountryAndOutletRange As Range ' creates a range which contains the original outlet resized to also select the cell to the left of it
Set CountryAndOutletRange = Range(InitialRange).Offset(0, -1).Resize(1, 2) ' [COLOR=rgb(184, 49, 47)]up to here is exectued successfully, this line does not run[/COLOR]
Range(CountryAndOutletRange).Activate
Application.CutCopyMode = False
Selection.Copy
NS.Select
Range("A2").Select
ActiveSheet.Paste
Range("B4").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = _
"=CONCAT('Master List'!R[-1]C[9],'Master List'!R[-2]C[1],'Master List'!R[-1]C[11])"
Range("B5").Select
ActiveCell.FormulaR1C1 = _
"=CONCAT('Master List'!R[-1]C[9],'Master List'!R[-3]C[1],'Master List'!R[-1]C[11],'Master List'!R[-3]C[2],'Master List'!R[-1]C[12])"
Range("B6").Select
Sheets("Master List").Select
Range("B3").Select
End Sub