A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data
If you want the list in column F, starting from F20, to be right-aligned, use the following modified macro:
Sub CopyAndRenameSheets()
Dim wsDash As Worksheet
Dim wsTemplate As Worksheet
Dim wsNew As Worksheet
Dim wsInsertAfter As Worksheet
Dim lastRow As Long
Dim i As Long
Dim newName As String
Dim outRow As Long
Set wsDash = ThisWorkbook.Worksheets("Dash Board")
Set wsTemplate = ThisWorkbook.Worksheets("Master_Template")
Set wsInsertAfter = wsTemplate
lastRow = wsDash.Cells(wsDash.Rows.Count, "C").End(xlUp).Row
outRow = 20
For i = 20 To lastRow
newName = Trim(wsDash.Cells(i, "C").Value)
If newName <> "" Then
wsTemplate.Copy After:=wsInsertAfter
Set wsNew = ActiveSheet
wsNew.Name = newName
wsDash.Hyperlinks.Add _
Anchor:=wsDash.Cells(outRow, "F"), _
Address:="", _
SubAddress:="'" & newName & "'!A1", _
TextToDisplay:=newName
' Right-align the list entry in column F
wsDash.Cells(outRow, "F").HorizontalAlignment = xlRight
Set wsInsertAfter = wsNew
outRow = outRow + 1
End If
Next i
End Sub
The added line is:
wsDash.Cells(outRow, "F").HorizontalAlignment = xlRight
This will right-align the content of each cell containing a hyperlink in column F.
I hope this helps. If there's any issue or if I've misunderstood your question, please feel free to reply and let me know.
If the answer is helpful, please kindly click "Yes" button below. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in the forum documentation to enable e-mail notifications if you want to receive the related email notification for this thread.