- I have a master worksheet listing all data in rows.
- A template to add more details for each unique record
- Need to create a worksheet for each entry in column "C" and updating the template with details in Name ( D) & Contact ( E) columns of respective row.
- Then Hyperlink the respective sheet with the entry in the rows.
With the help of few posts here i was able to run below code, which creates sheets, but i need help of populating data in Template from Master sheet and also creating a Hyperlink
Option Explicit
Sub SheetsFromTemplate()
Dim wsMASTER As Worksheet, wsTEMP As Worksheet, wasVISIBLE As Boolean
Dim shNAMES As Range, Nm As Range
With ThisWorkbook
Set wsTEMP = .Sheets("Template")
wasVISIBLE = (wsTEMP.Visible = xlSheetVisible)
If Not wasVISIBLE Then wsTEMP.Visible = xlSheetVisible
Set wsMASTER = .Sheets("Master")
Set shNAMES = wsMASTER.Range("C4:C" & Rows.Count).SpecialCells(xlConstants)
Application.ScreenUpdating = False
For Each Nm In shNAMES
If Not Evaluate("ISREF('" & CStr(Nm.Text) & "'!A1)") Then
wsTEMP.Copy After:=.Sheets(.Sheets.Count)
ActiveSheet.Name = CStr(Nm.Text)
End If
Next Nm
wsMASTER.Activate
If Not wasVISIBLE Then wsTEMP.Visible = xlSheetHidden
Application.ScreenUpdating = True
End With
MsgBox "All sheets created"
End Sub
.Find
orApplication.Match
) and if it matches one, then do a.value = .value
between the master and looped sheet with the relevant cells (Or do another loop through the relevant cells if you want your script a bit cleaner). – Simon