I'm trying to get my spreadsheet to automatically generate new names and sheets based on a data dump. I currently have the sheet working so that it will generate the name and sheet for each row of data, but I cannot get it to populate the sheet using that row.
There is a specific section of code that I cannot get to work:
    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)
            ActiveSheet.Range("A1:I1").Value = wsMASTER.Range("A" & Nm & ":I" & Nm) ' <<< This line here
        End If
    Next Nm
I know that the issue is using Nm to reference the cell (it's returning "OP01" which is the cell contents), but I'm trying to not add another workaround. I've tried using other functions to do similar after the Nm loop has finished, but can't seem to get those working either. Surely the answer has to be simple and I'm just missing something?
Option Explicit
Sub SheetsFromTemplate()
Application.ScreenUpdating = False
Rows("1:8").EntireRow.Delete
Call CreateLONums
Dim wsMASTER As Worksheet, wsTEMP As Worksheet, wsINDEX As Worksheet, wasVISIBLE As Boolean
Dim shNAMES As Range, Nm As Range
Dim firstrow As Long, lastrow As Long
With ThisWorkbook
    Set wsTEMP = .Sheets("Template")
    wasVISIBLE = (wsTEMP.Visible = xlSheetVisible)
    If Not wasVISIBLE Then wsTEMP.Visible = xlSheetVisible
    
    Set wsMASTER = .Sheets("Creation Page")
    Set wsINDEX = .Sheets("Local Options")
                                                                
    With Sheets("Creation Page").Columns("A")
        If WorksheetFunction.CountA(.Cells) = 0 Then
            MsgBox "Sorry: no data"
        Else
            With .SpecialCells(xlCellTypeConstants)
                firstrow = .Areas(1).Row
                lastrow = .Areas(.Areas.Count).Cells(.Areas(.Areas.Count).Rows.Count).Row
            End With
        End If
    End With
    Set shNAMES = wsMASTER.Range("A" & firstrow, "A" & lastrow)
    
    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)
            ActiveSheet.Range("A1:I1").Value = wsMASTER.Range("A" & Nm & ":I" & Nm)
        End If
        
    Next Nm
    
    wsINDEX.Activate
    If Not wasVISIBLE Then wsTEMP.Visible = xlSheetHidden
End With
Worksheets("Creation Page").Delete
Worksheets("Template").Delete
Call CreateLinksToAllSheets
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub
Sub CreateLONums()
Dim firstrow As Long, lastrow As Long, rowcount As Integer
Columns("A:A").Insert Shift:=xlToRight
With Sheets("Creation Page").Columns("B")
    If WorksheetFunction.CountA(.Cells) = 0 Then
        MsgBox "Sorry: no data"
    Else
        With .SpecialCells(xlCellTypeConstants)
            firstrow = .Areas(1).Row
            lastrow = .Areas(.Areas.Count).Cells(.Areas(.Areas.Count).Rows.Count).Row
        End With
    End If
    
    For rowcount = firstrow To firstrow + 9
        Range("A" & rowcount).Value = "OP0" & rowcount - firstrow + 1
    Next rowcount
    
    For rowcount = firstrow + 9 To lastrow
        Range("A" & rowcount).Value = "OP" & rowcount - firstrow + 1
    Next rowcount
End With
    
End Sub
Appreciate any insight available.
