Simple macro query -

steallan

Active Member
Joined
Oct 20, 2004
Messages
308
Hello

Sorry i'm bobbins at the coding still - im trying to get a macro that will scan down column A, where there's various filenames ( a couple of thousand). Sometimes i've got 2 filenames in one cell, one after the other, seperated by " ; " so space;space.

Where this occures im after the macro to insert a new row and copy the 2nd filename (so after the ;) into that row, and then continue on down column A

can anyone help me? I'd be very grateful.

Best regards

ste
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Hi Ste

Try this:

Code:
Sub test()
Dim i As Long, j As Long
Dim temp
For i = Cells(Rows.Count, "A").End(xlUp).Row To 1 Step -1
    If InStr(1, Cells(i, "A").Value, ";") > 0 Then
        temp = Split(Cells(i, "A").Value, ";")
        Cells(i, "A").Resize(UBound(temp)).EntireRow.Insert
        For j = 0 To UBound(temp)
            Cells(i + j, "A") = temp(j)
        Next j
    End If
Next i
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,597
Messages
6,179,808
Members
452,944
Latest member
2558216095

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top