Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have written a bit of code to delete a comma if it happens to be the first
character in a string, however my code seems to be deleting all commas, I am a VB beginner can anyone help me out? What I thought my code did: If have ",,Hello, my, name,,, is" in a cell before I run the code, after I run the code I would like the cell to look like "Hello, my, name,,, is" What my code seems to do: Output: "Hello my name is" This is my code (I have pieced it together from looking at the forum so I may not fully understand what is going on): Sub ahhhhhhhh() For Each cell In Range("H59:H60") If InStr(1, cell.Value, ",", vbTextCompare) = 1 Then cell.Value = Replace(cell.Value, ",", "", 1, -1, vbTextCompare) End If Next End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
count no. of commas (,) in a string in a cell | Excel Worksheet Functions | |||
String separated with commas | Excel Programming | |||
eliminating text between two specific characters | Excel Programming | |||
How can I break down a string with data divided by commas | Excel Programming | |||
removing commas from a string | Excel Programming |