Hi All,
I'm trying to use VBA to move a cell one column to the right if it contains a comma, below is the code I'm using.
My problem is that the code only looks to see if the whole cell value is a comma - I need it to work even if there is other text in the cell with the comma; I tried putting an asterisk either side of the comma in the code but it flagged an error...
Any tips would be appreciated, I'm probably missing something really basic!
Sub MoveComma()
Dim myrange, cell As Range
Set myrange = ActiveSheet.Range("K1", Range("K65536").End(xlUp))
For Each cell In myrange
If cell.Value = "," Then
cell.Cut
Range("K" & Application.WorksheetFunction.Max(2, cell.Row)).Offset(0, 1).Select
ActiveSheet.Paste
End If
Next cell
End Sub
Bookmarks