![]() |
help statement unfinished
Hi,
I've come up with this formula so far, but it needs to make a loop,I think with an If statement. Also the string to be found is always in column A. I didn't put it in there yet. Anyone? Cells.Find(What:="[bestandnaam*", After:=ActiveCell, LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False).Activate Range(Selection, Selection.End(xlToRight)).Select Selection.Cut Selection.Offset(1, 5).Select ActiveSheet.Paste |
help statement unfinished
Will this work for you? I removed the bracket ([) and replaced it
with a single character wild card. Sub this() For i = 2 To Cells(Rows.Count, "A").End(xlUp).Row If Cells(i, "A").Text Like "?bestandnaam*" Then Range(Cells(i, "A"), Cells(i, "A").End(xlToRight)).Cut _ Destination:=Cells(i, "A").Offset(1, 5) End If Next i End Sub Jootje wrote: Hi, I've come up with this formula so far, but it needs to make a loop,I think with an If statement. Also the string to be found is always in column A. I didn't put it in there yet. Anyone? Cells.Find(What:="[bestandnaam*", After:=ActiveCell, LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False).Activate Range(Selection, Selection.End(xlToRight)).Select Selection.Cut Selection.Offset(1, 5).Select ActiveSheet.Paste |
help statement unfinished
Sub ABCD()
Range("a1").Select Do Set rng = Columns(1).Find(What:="[bestandnaam*", _ After:=ActiveCell, LookIn:=xlValues, _ LookAt:=xlWhole, SearchOrder:=xlByRows, _ SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False) If Not rng Is Nothing Then rng.Select Range(Selection, Selection.End(xlToRight)).Select Selection.Cut Selection.Offset(1, 5).Select ActiveSheet.Paste Else Debug.Print "not found" End If Cells(ActiveCell.Row, 1).Select Loop Until rng Is Nothing End Sub -- Regards, Tom Ogilvy "Jootje" wrote: Hi, I've come up with this formula so far, but it needs to make a loop,I think with an If statement. Also the string to be found is always in column A. I didn't put it in there yet. Anyone? Cells.Find(What:="[bestandnaam*", After:=ActiveCell, LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False).Activate Range(Selection, Selection.End(xlToRight)).Select Selection.Cut Selection.Offset(1, 5).Select ActiveSheet.Paste |
help statement unfinished
Thanks! They both work very well for me!
"Tom Ogilvy" wrote: Sub ABCD() Range("a1").Select Do Set rng = Columns(1).Find(What:="[bestandnaam*", _ After:=ActiveCell, LookIn:=xlValues, _ LookAt:=xlWhole, SearchOrder:=xlByRows, _ SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False) If Not rng Is Nothing Then rng.Select Range(Selection, Selection.End(xlToRight)).Select Selection.Cut Selection.Offset(1, 5).Select ActiveSheet.Paste Else Debug.Print "not found" End If Cells(ActiveCell.Row, 1).Select Loop Until rng Is Nothing End Sub -- Regards, Tom Ogilvy "Jootje" wrote: Hi, I've come up with this formula so far, but it needs to make a loop,I think with an If statement. Also the string to be found is always in column A. I didn't put it in there yet. Anyone? Cells.Find(What:="[bestandnaam*", After:=ActiveCell, LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False).Activate Range(Selection, Selection.End(xlToRight)).Select Selection.Cut Selection.Offset(1, 5).Select ActiveSheet.Paste |
All times are GMT +1. The time now is 08:30 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com