View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Lucy Lucy is offline
external usenet poster
 
Posts: 37
Default multiply text and number

Thanks Joel, it works perfect!

"Joel" wrote:

Function Pallet(MyNum) As String
Pallet = String(Int(MyNum / 20) - 1, "L")
End Function

"Lucy" wrote:

Hi there, I'm writing a UDF and trying to multiply text and number. (Answer
will show in text)

Function Pallet(MyNum)
Dim i As Integer
i = MyNum Mod 20
Dim j As Integer
j = Fix(MyNum / 20)

if i = 9 and i <= 12 then "L" should appear (j-1) times
Let's say MyNum = 72
So, i = MyNum Mod 20 = 12
And j = Fix(MyNum / 20) = 3

I want the answer shows letter "L" appear (j-1) times, which is 2 times
like this : LL [in text format]

Is it possible?

Since outside this UDF, I count the total occurences of letter "L" in a
range. Therefore, i prefer answer in here shows "LL" instead of "2 L"

Thank you.