Trying to insert a "," in the 7th position from the right, if a cell length is > 6 AND the Cell contains a " . "
Trying to insert a "," in the 7th position from the right, if a cell length is > 6 AND the Cell contains a " . "
Off the top
If Len(cell).Value) > 6 And Instr(cell,".") > 0 Then cell.Value = Left$(cell.Value, 6) & "," & Mid$(cell.Value, 7,255) End If
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
Thanks Bob Phillips :
But This is putting the "," 7 places from the Left, not the 7th position from the Right.
Is this what you mean Bob meant?
= Left$(c.Value, Len(c) - 6) & "," & Mid$(c, Len(c) - 5, 6)
Last edited by jolivanes; 01-28-2021 at 11:39 PM.
Thanks jolivanes;
This solution is what worked.
Thanks for the efforts of all who contributed.If Len(cell.Value) > 6 And InStr(cell, ".") > 0 Then cell.Value = Left$(cell.Value, Len(cell) - 6) & "," & Mid$(cell, Len(cell) - 5, 6) End If
Sufficient:
Avoid variable names that can interfere with VBA names.If (Len(cl) > 6)*InStr(cl, ".") Then cl = Left(cl, Len(cl) - 6) & "," & Mid(cl, Len(cl) - 5)
Last edited by snb; 01-29-2021 at 09:34 AM.
Len(cl)
correct.
as usual!
snoever![]()
As ge oe čige nie kietelt dan laŕchte nooit!![]()
Kruikezeikers ?
Parel vh zuiden aka 't kielegat
compris !