Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub PartOfString()
Dim rng As Range Dim firstAddress As String Set rng = Cells.Find(what:="(*)", after:=Range("A1"), _ LookIn:=xlFormulas, LookAt:=xlWhole, _ SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False) If Not rng Is Nothing Then firstAddress = rng.Address Do With rng.Characters(Start:=2, _ Length:=Len(rng) - 2).Font .Name = "Arial" .FontStyle = "Bold" End With Set rng = Cells.FindNext(rng) If rng Is Nothing Then Exit Do Loop While rng.Address < firstAddress End If End Sub Assuming you don't want to work on cells like this cell has (12345) in it but only cells like (12345) -- Regards, Tom Ogilvy "brym" wrote in message ... Hi Tom! In my first post I changed the FindWhat to "(*)" and xlWhole. Now it only hits cells containing (number) and moreover only the first 3 letters are changed to bold. And no, it will always be in connection with a text. In my sheets i could have this in a cell: this is a sample (12345) cell value I want only (12345) to be e.g. bold. As mentioned in my later post, I can do this, IF I know the number of letters I'm searching for (?????). I would like only the brackets to be the limits. (Hitting an (abc) is ok. I'll find a solution for that.) Regards Birger |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Deleting a range of rows based on a variable; syntax error | Excel Discussion (Misc queries) | |||
macro syntax for selecting variable range | Excel Discussion (Misc queries) | |||
VBA Syntax for using a variable in a worksheet function | Excel Discussion (Misc queries) | |||
Syntax for variable search | Excel Programming | |||
Syntax for variable search | Excel Programming |