what is wrong with my Sub

  • Thread starter Thread starter =?iso-2022-jp?B?RVhDRUwbJEIhIRsoQk5FV1M=?=
  • Start date Start date
?

=?iso-2022-jp?B?RVhDRUwbJEIhIRsoQk5FV1M=?=

hi,
help me please.thank you

Function getval(v, chara)
getval = v
End Function

Sub funtest()
v = 123
c = "ok"
ActiveCell = "=getval(" + v + "," + c + ")"
End Sub

what is wrong with my Sub funtest.


thanks
 
Try


ActiveCell.FormulaR1C1 = "=getval(" & v & "," & c & ")"

this will display the value of v, the value of c will not display i
the formula

do you need a formula in the active cell or just the result of th
formula?

if only the value then try

ActiveCell.Value = v & c

or

ActiveCell.Value = v & " " &
 
thank you ,

it works well.
but, why & instead of +,
thanks
 
Hi
the '&' is used to concatenate strings (not the plus sign)

--
Regards
Frank Kabel
Frankfurt, Germany

EXCEL$B!!(BNEWS said:
thank you ,

it works well.
but, why & instead of +,
thanks
 
thanks for your help.

sorry to let me ask something more about it.

Function getval(v, chara, chara1, chara2, chara3, chara4)
getval = v
End Function

Sub funtest()
v = 123
c = "ok"
c1 = "ok"
c2 = "ok"
c3 = "ok"
c4 = "ok"
c5 = "ok"


ActiveCell.FormulaR1C1 = "=getval(" & v & "," & c & "," & c1 & "," & c2 &
"," & c3 & "," & c4 & ")"

'ActiveCell = "=getval(" + v + "," + c + ")"

End Sub

the value is ok.,but the following message (#name? errors) appears
,why,(when click "=")


regards

Frank Kabel said:
Hi
the '&' is used to concatenate strings (not the plus sign)
 
Back
Top