G
Guest
I have a cell with some formatting (an underlined digit) on one worksheet and
I would like to display it on another worksheet.
Why won't the following code, when invoked in sheet 2 such as
"=CopyNumberWithOneUnderlinedCharacter(Sheet1!A2)", display the cell. The
line inside the "If" complains that "A value used in the formula is of the
wrong type".
I've tried many variations of this but this one I think gets the point across.
Function CopyNumberWithOneUnderlinedCharacter(ByVal myCell As Range)
Dim l_Position As Integer
For l_Position = 1 To Len(myCell.Value)
If myCell.Characters(Start:=l_Position, Length:=1).Font.Underline _
<> xlUnderlineStyleNone Then
CopyNumberWithOneUnderlinedCharacter.Characters(Start:=l_Position,
Length:=1).Font.Underline = xlUnderlineStyleSingle
End If
Next l_Position
End Function
I would like to display it on another worksheet.
Why won't the following code, when invoked in sheet 2 such as
"=CopyNumberWithOneUnderlinedCharacter(Sheet1!A2)", display the cell. The
line inside the "If" complains that "A value used in the formula is of the
wrong type".
I've tried many variations of this but this one I think gets the point across.
Function CopyNumberWithOneUnderlinedCharacter(ByVal myCell As Range)
Dim l_Position As Integer
For l_Position = 1 To Len(myCell.Value)
If myCell.Characters(Start:=l_Position, Length:=1).Font.Underline _
<> xlUnderlineStyleNone Then
CopyNumberWithOneUnderlinedCharacter.Characters(Start:=l_Position,
Length:=1).Font.Underline = xlUnderlineStyleSingle
End If
Next l_Position
End Function