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
 

Some videos you may like

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Greg Truby

MrExcel MVP
Joined
Jun 19, 2002
Messages
10,014
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.
 

galileogali

Well-known Member
Joined
Oct 14, 2005
Messages
748
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
 

Watch MrExcel Video

Forum statistics

Threads
1,123,295
Messages
5,600,789
Members
414,405
Latest member
Zaurb

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
Top