Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
I have a column which contains text like A, A*,AI,AT,D, etc. I would like to replace only the A* value by A-* using vba (because excel consider the A* as any text beginning by A). My formula below doesn't work. Any idea? Thanks! Cells.Replace What:="A*", Replacement:="A-*", LookAt:=xlWhole, _ SearchOrder:=xlByColumns, MatchCase:=True, SearchFormat:=False, _ ReplaceFormat:=False -- Alex St-Pierre |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dim Cell As Range
For Each Cell In Range("C:C") If Left(Cell, 1) = "A" Then Cell = "A-" & Mid(Cell, 2) Next Cell "Alex St-Pierre" wrote: Hello, I have a column which contains text like A, A*,AI,AT,D, etc. I would like to replace only the A* value by A-* using vba (because excel consider the A* as any text beginning by A). My formula below doesn't work. Any idea? Thanks! Cells.Replace What:="A*", Replacement:="A-*", LookAt:=xlWhole, _ SearchOrder:=xlByColumns, MatchCase:=True, SearchFormat:=False, _ ReplaceFormat:=False -- Alex St-Pierre |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Do you know why the value is not replaced in excel ?
Cell = "ABC" does't work -- Alex St-Pierre "Charlie" wrote: Dim Cell As Range For Each Cell In Range("C:C") If Left(Cell, 1) = "A" Then Cell = "A-" & Mid(Cell, 2) Next Cell "Alex St-Pierre" wrote: Hello, I have a column which contains text like A, A*,AI,AT,D, etc. I would like to replace only the A* value by A-* using vba (because excel consider the A* as any text beginning by A). My formula below doesn't work. Any idea? Thanks! Cells.Replace What:="A*", Replacement:="A-*", LookAt:=xlWhole, _ SearchOrder:=xlByColumns, MatchCase:=True, SearchFormat:=False, _ ReplaceFormat:=False -- Alex St-Pierre |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
this is working:
For j = 1 To 65536 If Left(Cells(j, 3), 2) = "A*" Then Cells(j, 3) = "A-*" Next j -- Alex St-Pierre "Charlie" wrote: Dim Cell As Range For Each Cell In Range("C:C") If Left(Cell, 1) = "A" Then Cell = "A-" & Mid(Cell, 2) Next Cell "Alex St-Pierre" wrote: Hello, I have a column which contains text like A, A*,AI,AT,D, etc. I would like to replace only the A* value by A-* using vba (because excel consider the A* as any text beginning by A). My formula below doesn't work. Any idea? Thanks! Cells.Replace What:="A*", Replacement:="A-*", LookAt:=xlWhole, _ SearchOrder:=xlByColumns, MatchCase:=True, SearchFormat:=False, _ ReplaceFormat:=False -- Alex St-Pierre |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
something like this?
Cells.SpecialCells(xlCellTypeConstants).Select For Each rng In Selection If rng Like "A[*]*" Then rng.Value = Replace(rng, "A*", "A_*") End If Next keizi "Alex St-Pierre" wrote in message ... Hello, I have a column which contains text like A, A*,AI,AT,D, etc. I would like to replace only the A* value by A-* using vba (because excel consider the A* as any text beginning by A). My formula below doesn't work. Any idea? Thanks! Cells.Replace What:="A*", Replacement:="A-*", LookAt:=xlWhole, _ SearchOrder:=xlByColumns, MatchCase:=True, SearchFormat:=False, _ ReplaceFormat:=False -- Alex St-Pierre |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
"Find" a wildcard as a place marker and "replace" with original va | Excel Discussion (Misc queries) | |||
Vlookup, replace true text result with "X" | Excel Worksheet Functions | |||
Macro to Replace/Delete Text Using "Watchword" List? | Excel Discussion (Misc queries) | |||
Find and Replace causing a "Text" cell to become a custom date--wh | Excel Discussion (Misc queries) | |||
Replace dialog should put focus on "Find What" not "Replace With" | Excel Discussion (Misc queries) |