I am trying to pass variables to a sub routine, which must then establish an log based on the variables.
But I keep getting the following error:
"Compile error: Argument not optional"
As far as I understand this error indicates, that I have omitted a variable, but that is not the case. Can anyone help?
I call the procedure using:
The procedure it self is:
But I keep getting the following error:
"Compile error: Argument not optional"
As far as I understand this error indicates, that I have omitted a variable, but that is not the case. Can anyone help?
I call the procedure using:
Code:
Call WriteToLog(CurrentFileShort, Projektejer, fnameshort, SourceSheet_BCnumber, SourceRange_BCnumber, ErrorText, link)
The procedure it self is:
Code:
Sub WriteToLog(TargetFile As String, TargetSheet As String, shSkabelon as String, SourceFileShort As String, SourceSheet_BCnumber As String, SourceRange_BCnumber As String, ErrorText As String, SourceFileLong As String)
Workbooks(TargetFile).Activate
Workbooks(TargetFile).Sheets(TargetSheet).Select
Range("B1").Select
Call GoToLastRow
ActiveCell.Offset(0, 0) = Workbooks(SourceFileShort).Sheets(SourceSheet_BCnumber).Range(SourceRange_BCnumber)
ActiveCell.Offset(0, 1) = ErrorText
ActiveCell.Offset(0, 2).select
ActiveCell.Hyperlinks.Add Anchor:=Selection, Address:=SourceFileLong, TextToDisplay:=SourceFileLong
End SUb