Hello,
I am hoping someone can help with a repetitive error I am getting with the VBA code below. Basically, I am looping through a series of cells and assigning a hyperlink. What is frustrating is that the same code was working for me in an older version of the file, and when I clear everything out again, seems to work again before breaking.
The error I am getting is a Runtime 13 Error (Type Mismatch) that starts in the first ".hyperlink" bit of code. I am new to VBA, so I may be making a basic error, but I'm completely stuck.
Bonus points: I would like to add another loop that will change the race # (variable "r"), and repeat the code on 10 different sheets in sequential order ("Race_1"...."Race_10")
Thank you!!
I am hoping someone can help with a repetitive error I am getting with the VBA code below. Basically, I am looping through a series of cells and assigning a hyperlink. What is frustrating is that the same code was working for me in an older version of the file, and when I clear everything out again, seems to work again before breaking.
The error I am getting is a Runtime 13 Error (Type Mismatch) that starts in the first ".hyperlink" bit of code. I am new to VBA, so I may be making a basic error, but I'm completely stuck.
Code:
Sub Race_1()Dim i As Integer
Dim j As Integer
Dim r As Integer
i = 0
c = 0
j = 22
r = 1
Do Until c = 14
Do Until i = 10
With Worksheets("Race_" & r)
.Hyperlinks.Add Anchor:=.Cells(j, 7), _
Address:=Worksheets("RACE_" & r).Cells(j, 49).Value, _
ScreenTip:="Click to View Replay", _
TextToDisplay:="Replay"
Cells(j, 7).Font.Bold = "True"
End With
i = i + 1
j = j + 2
Loop
i = 0
j = j + 12
c = c + 1
Loop
End Sub
Bonus points: I would like to add another loop that will change the race # (variable "r"), and repeat the code on 10 different sheets in sequential order ("Race_1"...."Race_10")
Thank you!!