使这个代码循环直到最后一个非空行

我所做的一切,包括循环打破了代码。
我尝试使用For Loop遍历行,但它在userid线上错误。 我只需要做20次,20个不同的行。

 Sub Testbitly() Dim userid As String Dim apiKey As String Dim shortURL As String Dim URLcompleto As String userid = Sheets("Plan1").Cells(7, 6) apiKey = Sheets("Plan1").Cells(7, 7) URLcompleto = Sheets("Plan1").Cells(7, 8) shortURL = ShortenURL(userid, apiKey, _ URLcompleto, bitly) Range("I7").Select ActiveCell.FormulaR1C1 = shortURL End Sub 

 Sub Testbitly() Dim userid As String Dim apiKey As String Dim shortURL As String Dim URLcompleto As String Dim LastRow As Long LastRow = Sheets("Plan1").Cells(.Rows.Count, "F").End(xlUp).Row For i = 7 To LastRow userid = Sheets("Plan1").Cells(i, 6) apiKey = Sheets("Plan1").Cells(i, 7) URLcompleto = Sheets("Plan1").Cells(i, 8) shortURL = ShortenURL(userid, apiKey, _ URLcompleto, bitly) Sheets("Plan1").Cells(i, 9).FormulaR1C1 = shortURL Next i End Sub