Formato (negrillas)

ArmFeniX

New Member
Joined
Feb 27, 2009
Messages
3
Necesito saber como se puede cambiar el formato de una simple palabra de un texto, a traves de codigo o funciones

ejemplo

Ask any Excel questions in your native language, fecha 27/02/2009
necesito que quede asi

Ask any Excel questions in your native language, fecha 27/02/2009

Solo las palabras Excel y la fecha se deben cambiar a negrillas

y como la fecha viene de otra celda, necesito saber como cambiarle el formato por funciones o macros

Gracias
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Disculpe que no tengo tiempo para explicarle como funciona. Pero algo así es como hacerlo.
Code:
Sub ChangeTimeToBoldBlue()
    
    Const c_strKeyText = "time"
    
    Dim intPos As Integer
    
    Let intPos = InStr(1, ActiveCell.Text, c_strKeyText)
    
    If intPos > 0 Then
        With ActiveCell.Characters(Start:=intPos, _
                                   Length:=Len(c_strKeyText)).Font
            .Bold = True
            .Color = vbBlue
        End With
    End If
End Sub
Pero solamente se puede cambiar el formato de caracteres en una celda fija, o sea no se puede formatear caracteres individuales en una celda que contiene una fórmula.
 
Upvote 0
Pequeñas modificaciones a la macro de Greg, tratando de de aproximar la respuesta a tu pedido

Code:
Option Explicit

Sub ChangeExcelToBold()
    
    Const c_strKeyText = "Excel"
    
    Dim intPos As Integer
    
Let intPos = InStr(1, ActiveCell.Text, c_strKeyText)
    
    If intPos > 0 Then
        With ActiveCell.Characters(Start:=intPos, _
                                   Length:=Len(c_strKeyText)).Font
            .Bold = True

        End With
    End If
End Sub
Code:
Sub ChangeDateToBold()
Dim strKeyText As String
strKeyText = "fecha " & Format(Date, "dd/mm/yyyy")
    
    Dim intPos As Integer
    
Let intPos = InStr(1, ActiveCell.Text, strKeyText)
    
    If intPos > 0 Then
        With ActiveCell.Characters(Start:=intPos, _
                                   Length:=Len(strKeyText)).Font
            .Bold = True

        End With
    End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,971
Messages
6,122,525
Members
449,088
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top