View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ken Hudson Ken Hudson is offline
external usenet poster
 
Posts: 186
Default Macro or VBA to Bold first 3 characters of a cell in the entire co

Hi,

Copy this code into ThisWorkbook, not a module:

Private Sub Workbook_Open()

Dim Iloop As Double
Dim RowCount As Double
Dim StartChar As Integer
Dim BoldLen As Integer

StartChar = 3
BoldLen = 5
RowCount = Cells(Rows.Count, "C").End(xlUp).Row
For Iloop = 1 To RowCount
Cells(Iloop, "C").Characters(StartChar, BoldLen).Font.Bold = True
Next Iloop

End Sub

This will bold characters 3 through 5, not the first 3.
--
Ken Hudson


"imelda1ab" wrote:

My macro to bold the first three characters of a cell works great but
I am struggling with enhancing the macro to automatically repeat for
the entire column "C" instead of running it cell by cell. Ideally,
the macro would run on open, but I'll settle for running it on
command.

Any help is greatly appreciated!

Dim StartChar As Integer
Dim BoldLen As Integer
StartChar = 3
BoldLen = 5
ActiveCell.Characters(StartChar, BoldLen).Font.Bold = True