HayabusaPR
New Member
- Joined
- Jul 16, 2019
- Messages
- 14
I was able to create this Macro with the help of @Logit
in this section
' Create the Concatenate Formula and Autofill Formula to the Last Row with Data the concatenate works but it goes down to row 10,000 and I would like the macro to stop the concatenate formula when the cell on the right is empty. Thanks for the help
in this section
' Create the Concatenate Formula and Autofill Formula to the Last Row with Data the concatenate works but it goes down to row 10,000 and I would like the macro to stop the concatenate formula when the cell on the right is empty. Thanks for the help
Code:
Sub OpenFile()
' Turns Off Screen Updating While the Macro is Running
Application.ScreenUpdating = False
' Open File from Location, Copy/Paste Data and Insert the Path Column
Workbooks.Open Sheet1.Range("B7").Value & Sheet1.Range("B6").Value
Columns("A:R").Select
Selection.copy
Windows("Mapping Table Macro Working File.xlsm").Activate
Sheets("Mapping Table").Select
ActiveSheet.Paste
Columns("D:D").Select
Application.CutCopyMode = False
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Range("D1").Select
ActiveCell.FormulaR1C1 = "Path"
[B] ' Create the Concatenate Formula and Autofill Formula to the Last Row with Data
Range("D2").Select
ActiveCell.FormulaR1C1 = _
"=CONCATENATE(RC[1],"" / "",RC[2],"" / "",RC[3],"" / "",RC[4],"" / "",RC[5],"" / "",RC[6],"" / "",RC[7],"" / "",RC[8],"" / "",RC[9],"" / "",RC[10],"" / "",RC[11],"" / "",RC[12],"" / "",RC[13],"" / "",RC[14],"" / "",RC[15])"
Selection.AutoFill Destination:=Range("D2:D10000")
Range("D2:D10000").Select[/B]
' Assing Columns Width size
Selection.columnwidth = 11
Columns("B:B").Select
Selection.columnwidth = 16
Columns("C:C").Select
Selection.columnwidth = 11
Columns("D:D").Select
Selection.columnwidth = 37
Columns("E:E").Select
Selection.columnwidth = 18
Columns("F:F").Select
Selection.columnwidth = 22
Columns("G:G").Select
Selection.columnwidth = 11
Columns("H:H").Select
Selection.columnwidth = 18
Columns("I:I").Select
Selection.columnwidth = 19
Columns("J:J").Select
Selection.columnwidth = 22
Columns("K:K").Select
Selection.columnwidth = 13
Columns("L:L").Select
Selection.columnwidth = 18
Columns("M:M").Select
Selection.columnwidth = 18
Columns("N:N").Select
Selection.columnwidth = 18
Columns("O:O").Select
Selection.columnwidth = 18
Columns("P:P").Select
Selection.columnwidth = 18
Columns("Q:Q").Select
Selection.columnwidth = 18
Columns("R:R").Select
Selection.columnwidth = 18
Columns("S:S").Select
Selection.columnwidth = 18
' Format File
Cells.Select
With Selection.Font
.Name = "Arial"
.Size = 11
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
With Selection.Font
.Name = "Arial"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
Rows("1:1").Select
Selection.Font.Bold = True
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Columns("D:D").Select
With Selection
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
With Selection
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range("A1").Select
' Turns screen updating back on
Application.ScreenUpdating = True
'Displays message to user once the macro is complete running
MsgBox "Process Completed. Have a nice day!"
End Sub
Last edited by a moderator: