Loop through collumn

Sebas123

New Member
Joined
Aug 12, 2011
Messages
4
Hello,

I have a excel sheet that houses some wrong data in the first collumn. The lay-out is as following.

Column A:
1111-111111.ipt,
1111-111112.ipt,
1111-111113.ipt ect.

The amount of rows in this column variable. (From 5 to 50).

I want to loop through the collumn and remove the ".ipt" in every cell. Can somebody help me with this?


Thanks,
Sebas123
 
Last edited:

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Try

Code:
Sub test()
Dim LR As Long, i As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
For i = 1 To LR
    With Range("A" & i)
        .Value = Replace(.Value, ".ipt", "")
    End With
Next i
End Sub
 
Upvote 0
Try

Code:
Sub test()
Dim LR As Long, i As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
For i = 1 To LR
    With Range("A" & i)
        .Value = Replace(.Value, ".ipt", "")
    End With
Next i
End Sub

Thank you so much,

This is perfect.

Thanks,
Sebas123
 
Upvote 0
I'm pretty sure this one-liner macro will do what you want (and it should be quite snappy about it)...

Code:
Sub DeleteDotIPT()
  Columns("A").Replace ".ipt", "", xlPart
End Sub
You could, of course, do the same thing without using a macro. Select Column A, press CTRL+H and put .ipt (note the leading dot) in the "Find what" field, leave the "Replace with" field empty and click "Options>>" to see all the options and make sure "Match entire cell contents" is not checked, then click the "Replace All" button.
 
Last edited:
Upvote 0
USe the built in Find and Replace function?

Find What: .ipt
Replace With: Leave this blank
 
Upvote 0

Forum statistics

Threads
1,224,602
Messages
6,179,847
Members
452,948
Latest member
UsmanAli786

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