conditionel goto command in vba

Occasional Contributor

Hi experts, i want to create a button on my sheet, which will take me conditionally to the next step.

if the first is not complete it will take me back to the first step (i don't want to use the hyperlink formula)

so, I want to do something like a conditional gotocell macro, and assign it on a shape.

(in the picture, just if first and last names are entered i want it should take me back to the next sheet, if not it shold take me back to the empty fields)


As a hyperlink I would write something like this: =HYPERLINK("#"&IF(I10="","Name!I10",IF(I14="","Name!I14","details!a1")),"Next>")



3 Replies
Why not use that HYPERLINK function?

  I want it to be non-editable. I don't want to lock the cell because I wanna set the locked cells to be non-selectable!.@Jan Karel Pieterse 

​  Hi , no need i figured the commend my self. 

here is it:


Sub variables()

    If IsEmpty(Range("i10")) Then
        Application.Goto Reference:=Worksheets("name").Range("i10"), _
    ElseIf IsEmpty(Range("i14")) Then
        Application.Goto Reference:=Worksheets("name").Range("i14"), _
       Application.Goto Reference:=Worksheets("details").Range("A3"), _
    End If
End Sub