Excel VBA hyperlink in userform -
i have created userform , when insert name in userform data written on first empty cell , creates new sheet same name. problem im having need create hyperlink name sheet when press on name directly takes me sheet. code im getting subscript out of range in hyperlink
private sub okbutton_click() dim test worksheet sheet11.copy after:=sheets("clients") set test = activesheet test.name = nametextbox.value range("b9").value = nametextbox.value dim emptyrow long 'make sheet1 active sheet1.activate 'determine emptyrow emptyrow = worksheetfunction.counta(range("a:a")) + 1 'transfer information cells(emptyrow, 1).value = nametextbox.value cells(emptyrow, 2).value = test.range("e51").value 'add hyperlink sheets("sheet1").hyperlinks.add sheets("sheet1").cells(emptyrow, 1), "", sheets("nametextbox.value").name & "!a1", "nametextbox.value" 'empty nametextbox nametextbox.value = "" 'set focus on nametextbox nametextbox.setfocus end sub
i removed quotes nametextbox
still getting same error subscript out of range
.
Comments
Post a Comment