Hi,
I tried to make something to find a certain value (from a userform) in a range, and then copy the line partially to another sheet. Then go forth to the next found item and do the same. But... I cannot seem to make this loop. Anybody can advise...?
With Sheets("Data input").Range("N5:N1100")
Dim FoundRange As Range
Worksheets("Data input").Activate
For X = 1 To 1000
Set FoundRange = Sheets("Data input").Cells.Find(what:=Planweeknr.Value, LookIn:=xlValues, lookat:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If FoundRange Is Nothing Then
End
Else
FoundRange.Select
ActiveCell.Select
ActiveCell.Offset(0, 2).Range("A1").Select
Range(Selection, Selection.End(xlToLeft)).Select
Range(Selection, Selection.End(xlToLeft)).Select
Range(Selection, Selection.End(xlToLeft)).Select
ActiveCell.Activate
Selection.Copy
Sheets("Detail overzicht VAL").Select
Range("C5").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, -2).Range("A1").Select
ActiveSheet.Paste
ActiveCell.Select
ActiveWindow.SmallScroll Down:=6
End If
Next X
End With
Unload Me
I tried to make something to find a certain value (from a userform) in a range, and then copy the line partially to another sheet. Then go forth to the next found item and do the same. But... I cannot seem to make this loop. Anybody can advise...?
With Sheets("Data input").Range("N5:N1100")
Dim FoundRange As Range
Worksheets("Data input").Activate
For X = 1 To 1000
Set FoundRange = Sheets("Data input").Cells.Find(what:=Planweeknr.Value, LookIn:=xlValues, lookat:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If FoundRange Is Nothing Then
End
Else
FoundRange.Select
ActiveCell.Select
ActiveCell.Offset(0, 2).Range("A1").Select
Range(Selection, Selection.End(xlToLeft)).Select
Range(Selection, Selection.End(xlToLeft)).Select
Range(Selection, Selection.End(xlToLeft)).Select
ActiveCell.Activate
Selection.Copy
Sheets("Detail overzicht VAL").Select
Range("C5").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, -2).Range("A1").Select
ActiveSheet.Paste
ActiveCell.Select
ActiveWindow.SmallScroll Down:=6
End If
Next X
End With
Unload Me