Hello,
I have a function which is working for one place in the Sub code:
But When I call it in more than one place, I get an error <ByRef arugment type mismatch>
I call the function like:
It highlights the third parameter - rngMotivation
Thanks!
I have a function which is working for one place in the Sub code:
Code:
Public Function Counter(ByVal ctl As Control, s As Double, rng As Range) As Double
Dim size As Double
With UserForm1.Frame1
size = Application.WorksheetFunction.RoundUp(Len(ctl) / 52, 0)
With rng
.RowHeight = (size * 10)
Counter = .RowHeight
End With
End With
End Function
I call the function like:
Code:
With rngMotivation
.Offset(0, 1).Value = " " & txtMotivation.Text
size1 = Counter(UserForm1.txtMotivation, 0, rngMotivation)
.RowHeight = size1
End With
Thanks!