ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Format Help BOLD year in a specific vehicle application Column (https://www.excelbanter.com/excel-worksheet-functions/132645-format-help-bold-year-specific-vehicle-application-column.html)

mobile electronics installer

Format Help BOLD year in a specific vehicle application Column
 
Basically I am a mobile electronics installer. I have created an inventory of
what metra kits (www.metraonline.com) we have, where they are stored, and
specific vehicle application. Now what I would like is the year to be bolded.
It varies from line to line but most are like this "Hyndia Excel 86-89
Mitsubishi Precis 87-89" or "Mazda Multi Kit 86-95 Dash Bezel Mount" and
"Honda Accord 03-Up" Is it possible to custom format this to diffientiate
between the Make model, and the year?




Roger Govier

Format Help BOLD year in a specific vehicle application Column
 
Hi

You can do it manually by just highlighting the relevant characters in
the formula bar and pressing the Bold icon.
For a large list of cells, you would need to use some VBA code to
achieve this.

If you mark the range of cells on your sheet containing these entries,
then run the code below, it should carry out the task for you.

Sub BoldYear()
Dim test As String, First As Integer, Last As Integer, i As Integer,
Length As Integer
Dim c As Range
For Each c In Selection
test = c.Value
' find first numeric
For i = 1 To Len(test)
If IsNumeric(Mid(test, i, 1)) Then
First = i
Exit For
End If
Next

'find last numeric
For i = First + 1 To Len(test)
If Mid(test, i, 1) < "-" Then
If Not IsNumeric(Mid(test, i, 1)) Then
Last = i
Exit For
End If
End If
Next

If Last = 0 Then Last = i
Length = Last - First
' now embolden from first to last characters
With c.Characters(Start:=First, Length:=Length).Font
.FontStyle = "Bold"
End With
First = 0: Last = 0: Length = 0
Next c
End Sub


You can copy the code and paste it into your Visual Basic Editor
(VBE) in a Standard Module located in your file.

To do this,

Alt + F11 (open VBE)
Ctrl + R (open Project Explorer)
Select the file name on the left
Insert Module
Paste code in Module

David McRitchie has lots of useful help on his site at
http://www.mvps.org/dmcritchie/excel/install.htm
http://www.mvps.org/dmcritchie/excel/getstarted.htm


--
Regards

Roger Govier


"mobile electronics installer" <mobile electronics
wrote in message
...
Basically I am a mobile electronics installer. I have created an
inventory of
what metra kits (
www.metraonline.com) we have, where they are stored,
and
specific vehicle application. Now what I would like is the year to be
bolded.
It varies from line to line but most are like this "Hyndia Excel 86-89
Mitsubishi Precis 87-89" or "Mazda Multi Kit 86-95 Dash Bezel Mount"
and
"Honda Accord 03-Up" Is it possible to custom format this to
diffientiate
between the Make model, and the year?







All times are GMT +1. The time now is 12:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com