Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Are the brackets shown because the number is negative - therefore they are
produced by a number format? If they are not, then the entries are text and can be found with "(*)" and lookat:=xlWhole although this would hit on "(abc)" as well. You would then need to check if the interior is numeric. Regards, Tom Ogilvy "brym" wrote in message ... Hi! This macro I would like to enhance to be more flexible. But before I start doing (trying) that, I need some help re. the searching syntax. There's no problem finding a specified part of a string and change the properties. However, (as I expected) the SQL syntax doesn't work with the FindWhat var. Can anyone help me with the syntax so I may find/isolate any number surrounded by brackets, e.g (98765) or (1234567). Sub PartOfString() Dim Pos, Lngt As Integer Dim FindWhat As String On Error Resume Next FindWhat = "Perfect" ' Should be "(" and any whole number and ")" Cells.Find(what:=FindWhat, after:=ActiveCell, LookIn:=xlFormulas, LookAt _ :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _ False).Activate Lngt = Len(FindWhat) Pos = InStr(ActiveCell.Value, FindWhat) With ActiveCell.Characters(Start:=Pos, Length:=Lngt).Font .Name = "Arial" .FontStyle = "Normal" End With End Sub OR MAYBE - another way to do the trick !? Thanks in advance Regards Birger |
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 |