0
有人可以幫助我在我需要的時間。我創建了一個userform
,輸入的hyperlink
取決於從listbox
的下拉菜單。運行時錯誤1004與VBA添加超鏈接
儘管超級鏈接實際上要在按下提交按鈕的時候,我還在接受
運行時錯誤1004應用程序定義或對象定義錯誤的錯誤消息。
當調試ws.cells(iRow, 4)
是該行強調
Private Sub Comm1_Click()
Dim iRow As Long
Dim ws As Worksheet
Dim ws2 As Worksheet
Dim rng As Range
Set ws = Worksheets("QttOutlay")
Set ws2 = Worksheets("LookupVals")
iRow = ws.Cells.Find(what:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
Set rng = ws.Cells(iRow)
ws.Cells(iRow, 2).Value = RmRef.Value
ws.Cells(iRow, 3).Value = RetMod.Value
ws.Cells(iRow, 4).Value = rng.Parent.Hyperlinks.Add(Anchor:=rng, Address:=WorksheetFunction.VLookup(RetMod.Value, ws2.Range("A:B"), 2, False), TextToDisplay:="Info")
ws.Cells(iRow, 5).Value = OrdCod.Value
ws.Cells(iRow, 6).Value = hmm.Value
ws.Cells(iRow, 7).Value = lmm.Value
ws.Cells(iRow, 8).Value = rdtype.Value
ws.Cells(iRow, 9).Value = dtt.Value
ws.Cells(iRow, 10).Value = Wtt.Value
ws.Cells(iRow, 11).Value = Qt.Value
ws.Cells(iRow, 12).Value = LPc.Value
ws.Cells(iRow, 13).Value = Dt.Value
ws.Cells(iRow, 14).Value = (LPc.Value * Dt.Value) * Qt.Value
End Sub