Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
IF statement inside a SUMIF statement.... or alternative method | Excel Worksheet Functions | |||
Reconcile Bank statement & Credit card statement & accounting data | Excel Worksheet Functions | |||
Embedding an OR statement in an IF statement efficiently | Excel Discussion (Misc queries) | |||
appending and IF statement to an existing IF statement | Excel Worksheet Functions | |||
If statement and Isblank statement | Excel Worksheet Functions |