DataBlake
Well-known Member
- Joined
- Jan 26, 2015
- Messages
- 781
- Office Version
- 2016
- Platform
- Windows
Code:
Dim lastRow As Long
destrow = Sheets("Master Wheel").Range("A" & Rows.Count).End(xlUp).Row
Columns("T:T").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Range("T2").Select
ActiveCell.FormulaR1C1 = _
"=IF(ISERROR(VLOOKUP(RC[-19],'Master Wheel'!R1:R1048576,1,FALSE)),""err"",""delete"")"
lastRow = Range("A" & Rows.Count).End(xlUp).Row
Range("T2").AutoFill Destination:=Range("T2:T" & lastRow)
Columns("T:T").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Cells.Select
Application.CutCopyMode = False
ActiveWorkbook.Worksheets("WheelPros").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("WheelPros").Sort.SortFields.Add Key:=Range( _
"T2:T" & lastRow), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("WheelPros").Sort
.SetRange Range("A1:XF1000000")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Columns("T:T").Select
Selection.Find(What:="err", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.EntireRow.Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("Master Wheel").Select
Range("A" & destrow).Select
ActiveSheet.Paste
Hey so i have this code that i'm trying to make work.
Everything is fine unless there is only 1 item in column T
for that reason i'm trying to figure out how i can get the range from the activecell "err" (row)
to the bottom of rows.count
Code:
Range(selection, Rows.Count)).select
any help would be appreciated