View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
FSt1 FSt1 is offline
external usenet poster
 
Posts: 3,942
Default Format Cell as 2 different formats

forgot to mention....
for rng.value i used rng.value in the active cell
for DtTxt i converted todays date in b1 to text in c1 with
=text(B1,"mm/dd/yy")
that is how i got the start number and length number.
multple formats in a cell doesn't not work for formulas or true numbers.
text and numbers formated as text only.

Regards
FSt1

"FSt1" wrote:

hi
try something like this.....
Private Sub Promise_Click()
Dim Rng As Range
Dim DtTxt As String
DtTxt = [C1].Value
Set Rng = Selection
Rng.UnMerge
Set Rng = Rng.Resize(1, 1)
Rng = Rng.Value & " " & DtTxt
Set Rng = Rng.Resize(1, 5)
Rng.Merge
With ActiveCell.Characters(Start:=13, Length:=9).Font
.Size = 8
.ColorIndex = 3
End With
end sub

regards
FSt1

"jlclyde" wrote:

I have a macro that I am adding a date to a cell with VBA and at the
same time I would like to change the format of just the date to red
and a little smaller. DtTxt is the date.

Here is my current code. Obviously this is used within a form.

Thanks,
Jay

Private Sub Promise_Click()
Dim Rng As Range
Set Rng = Selection
Rng.UnMerge
Set Rng = Rng.Resize(1, 1)
Rng = Rng.Value & " " & DtTxt
Set Rng = Rng.Resize(1, 5)
Rng.Merge

SelectIt 'This is another subroutine that I run
With Selection
.Interior.ColorIndex = 4
End With
End Sub