I have a VBA code i have written. It is supposed to:
1. Look at "HAZOP" Sheet
2. For each row that has an ID in Column A, create a new sheet and paste each ID into cell Q1.
What the below currently does is what I want, but doesnt include items where the ID is further down the sheet and has blanks on top of it. It also creates two blank sheets at the end which dont have any data in the, labelled "D_" and "HazopMasterAction(2)".
What do i need to change to make it work for all items with an ID and also to stop creating the blank sheets at the end?
Thanks so much for your help!!!
Dim LR As Long, ID As Range, Emp As Range
Application.ScreenUpdating = False
LR = Sheets("HAZOP").Cells(Rows.Count, 1).End(xlUp).Row
Set Emp = Sheets("HAZOP").Range("A3:A5000" & LR)
For Each ID In Emp
Sheets("HazopMasterAction").Range("Q1") = ID
ActiveSheet.Name = "D" & "_" & ID.Value
Application.ScreenUpdating = True