ldperrotta
03-27-2014, 08:05 PM
Sub DelLeft()
Dim l as long, d as long
l = Len(Selection)
d = InStr(1, Selection, " ")
If Not d = 0 Then Selection.Offset(, 1) = Right(Selection, l - d)
End Sub
****************
I've been looking for hours for some macro help that does just this EXCEPT that it only works when I select one cell at a time. I need to select many cells. I can't figure out what the limitation is here. When I select more than one cell and run the macro, I get Run-time error 13, Type Mismatch. The Debugger highlights this line: l = Len(Selection)
Is this code intended to work for one cell at a time?
I know just enough to be dangerous with macros but have been helped tremendously thus far by the experts here. Thank you.
Dim l as long, d as long
l = Len(Selection)
d = InStr(1, Selection, " ")
If Not d = 0 Then Selection.Offset(, 1) = Right(Selection, l - d)
End Sub
****************
I've been looking for hours for some macro help that does just this EXCEPT that it only works when I select one cell at a time. I need to select many cells. I can't figure out what the limitation is here. When I select more than one cell and run the macro, I get Run-time error 13, Type Mismatch. The Debugger highlights this line: l = Len(Selection)
Is this code intended to work for one cell at a time?
I know just enough to be dangerous with macros but have been helped tremendously thus far by the experts here. Thank you.