Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a sheet full of numbers, intermixed with other data, and need to
change certain cells based on a single criteria. If the cell contains the character : then I need to add 0: to the beginning of the current string in that cell. Can anyone help me with a concise bit of code that will search one sheet and change those selected cells? Thank you in advance. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub colonate()
Dim s As String For Each r In ActiveSheet.UsedRange s = r.Value If InStr(s, ":") 0 Then r.Value = "0:" & s End If Next End Sub -- Gary''s Student - gsnu200718 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub AAA()
Dim cell As Range For Each cell In Selection.SpecialCells(xlConstants, xlTextValues) Debug.Print cell.Address, cell.Text If InStr(1, cell.Value, ":", vbTextCompare) Then cell.Value = "'0:" & cell.Value End If Next End Sub -- Regards, Tom Ogilvy "Mahnian" wrote: I have a sheet full of numbers, intermixed with other data, and need to change certain cells based on a single criteria. If the cell contains the character : then I need to add 0: to the beginning of the current string in that cell. Can anyone help me with a concise bit of code that will search one sheet and change those selected cells? Thank you in advance. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how to change a cell color based on its content using macro? | New Users to Excel | |||
Change row height based on content of merged cell | Excel Programming | |||
how do I change the content of one cell based on another? | Excel Discussion (Misc queries) | |||
Change the data in one cell based on content of another. | Excel Discussion (Misc queries) | |||
How do I change content of a cell based on date | Excel Worksheet Functions |