View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default [beginner] create macro to insert symbol

Try:

sStr1 = Application.Rept(Chr(218), Num) & sStr

But then the loop has to do the font changes at the beginning.

Option Explicit
Sub InsertArrow2()

Dim sStr As String
Dim sStr1 As String
Dim Num As Long

sStr = ActiveCell.Value
Num = 3
sStr1 = Application.Rept(Chr(218), Num) & sStr
ActiveCell.Value = sStr1
'Debug.Print sStr1, Len(sStr), Len(sStr1)
With ActiveCell.Characters(Start:=1, Length:=Num).Font
.Name = "Wingdings"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With

End Sub

Artavar wrote:

Hi again,

I now fixed the shortcut problem, but when I change the code to sStr1 =
Application.Rept(Chr(218), Num) & *str* , then I get the error message
Compile error: Argument not optional and str is highlited in the VBA
editor....
Can you tell me what is still wrong about it?

Thanks a lot already,

Artavar

--
Artavar
------------------------------------------------------------------------
Artavar's Profile: http://www.excelforum.com/member.php...o&userid=25029
View this thread: http://www.excelforum.com/showthread...hreadid=385571


--

Dave Peterson