Hello! I am trying to write a code that selects a range of data and moves it to a new sheet. I want it to select beginning when column 6=1 and 7=18 and go until 6=10 and 7=-35
I tried the code before, but it doesnt move the right range... Am I using the .find wrong? Any help appreciated. Thank you!
Code:Dim lRow1 As Long, lRow2 As Long Dim lStart As Long, lEnd As Long With Columns(6) lRow1 = .Find(What:="1", After:=Cells(1, 6), LookIn:=xlFormulas _ , LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False).row lRow2 = .Find(What:="10", After:=Cells(1, 6), LookIn:=xlFormulas _ , LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False).row End With With Columns(7) lRow1 = .Find(What:="18", After:=Cells(1, 7), LookIn:=xlFormulas _ , LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False).row lRow2 = .Find(What:="-35", After:=Cells(1, 7), LookIn:=xlFormulas _ , LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False).row End With Sheets.Add ActiveSheet.Name = "FreezeControl" Sheets("control").Select rows(lRow1 & ":" & lRow2).Select Selection.Copy Sheets("Freezecontrol").Select Range("A1").Select ActiveSheet.Paste


Reply With Quote
