I have a userform that creates and fills in a new sheet from a template and fills in a master sheet. I am having issues with the master sheet overwriting the information already there. I would also like the Job Numbers on the master sheet to automatically add a hyperlink to the corresponding sheet.
Here is the code I seem to be having trouble with:
Set Ws = Worksheets("Master")
'Find first empty row
iRow = Ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
'Add data from details sheet to database
With Ws
.Cells(iRow, 1).Value = Me.jobNumber.Value
.Cells(iRow, 2).Value = Me.jobDescription.Value
.Cells(iRow, 3).Value = NewSheet.Range("C14").Value
.Cells(iRow, 4).Value = NewSheet.Range("H14").Value
End With
'Hyperlink job number to corresponding sheet
i = Ws.Cells(Rows.Count, "A").End(xlUp).Row + 1
ActiveCell.Hyperlinks.Add anchor:=Ws.Cells(i, 1), Address:="", SubAddress:=NewSheet.Name
MsgBox "New job has been added."
Worksheet("Master").Show
Application.ScreenUpdating = True
Bookmarks