View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Jarek Kujawa[_2_] Jarek Kujawa[_2_] is offline
external usenet poster
 
Posts: 896
Default Need to conditionally duplicate rows

finally I'm finished <g

that's not a neat one (and may be a bit slow) but try:

On Error Resume Next
For i = 1 To Selection.Cells.Count + 1
If Application.WorksheetFunction.Find(",", ActiveCell.Value) Then
ActiveCell.Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Cut
ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste
ActiveCell.Offset(-1, 0).Value = Left(ActiveCell,
Application.WorksheetFunction.Find(",", ActiveCell) - 1)
ActiveCell.Value = Right(ActiveCell, Len(ActiveCell) -
Application.WorksheetFunction.Find(",", ActiveCell))
Range(Selection.Offset(1, 0), Selection.End(xlDown)).Select
End If
Next i

Application.CutCopyMode = False

End Sub


HIH