Hi. I'm new to VBA and I'm trying to code some things to auto populate new sheets. I have this code below that works great. It takes each line of a range and adds a new sheet naming it from each row in the range. However, on each new sheet I also need it to copy and paste data from another range (D3:D(length dependant on lines of nonblank data)) and paste each new line to cell (L1) of the current newly made sheet. It also has to have a hard return so that other formulas on the new sheet recognize that data is in L1. Like the below code this would loop until it reaches the first blank row. Thanks!
Sub Copy_Sheets()
Dim Rng As Range, cell As Range
Dim LR As Long
LR = Sheets("Diver Data").Range("D" & Rows.Count).End(xlUp).Row
Set Rng = Sheets("Diver Data").Range("F3:F" & LR)
For Each cell In Rng
If Not Evaluate("ISREF('" & cell & "'!F3)") Then
Sheets("Blank IHSA Sheet").Copy After:=Sheets(Sheets.Count)
ActiveSheet.Name = cell
End If
Next
End Sub
Sub Copy_Sheets()
Dim Rng As Range, cell As Range
Dim LR As Long
LR = Sheets("Diver Data").Range("D" & Rows.Count).End(xlUp).Row
Set Rng = Sheets("Diver Data").Range("F3:F" & LR)
For Each cell In Rng
If Not Evaluate("ISREF('" & cell & "'!F3)") Then
Sheets("Blank IHSA Sheet").Copy After:=Sheets(Sheets.Count)
ActiveSheet.Name = cell
End If
Next
End Sub