Re: Need help with macro to delete rows based on criteria
Hi, so this report has changed because I had to add another column which shifted all the other columns.
I tried to change it but could not get it to work correctly. Here is the layout of the new columns.
[/IMG]
Also prior to this step I am trying to create a macro to shift the columns around to the layout I need. There is one column named customer that is a vlookup that pulls from a tab in sheet and is named Tier List and uses column formula is VLOOKUP(H2,'Tier List '!B:C,2,FALSE) H2 is the variable data to search match to , and the other named days is a 360 formula that calculates the number of days between the order date in column A and today. Because the # of rows change each time i run report, I cant just copy the formula down in the macro. Below is my macro I created so far. Thanks in advance
Sub bko_step1()
'
' bko_step1 Macro
'
' Keyboard Shortcut: Ctrl+q
'
Cells.Select
With Selection.Font
.Name = "Calibri"
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
With Selection.Font
.Name = "Calibri"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
Columns("E:L").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Columns("AM:AM").Select
Selection.Cut Destination:=Columns("E:E")
Columns("AJ:AK").Select
Selection.Cut Destination:=Columns("F:G")
Range("H1").Select
ActiveCell.FormulaR1C1 = "Customer"
Columns("R:S").Select
Selection.Cut Destination:=Columns("I:J")
Columns("U:U").Select
Selection.Cut Destination:=Columns("K:K")
Columns("T:T").Select
Selection.Cut Destination:=Columns("L:L")
Columns("R:U").Select
Selection.Delete Shift:=xlToLeft
Columns("AF:AG").Select
Selection.Delete Shift:=xlToLeft
ActiveWindow.ScrollColumn = 13
ActiveWindow.ScrollColumn = 14
ActiveWindow.ScrollColumn = 15
ActiveWindow.ScrollColumn = 16
ActiveWindow.ScrollColumn = 17
ActiveWindow.ScrollColumn = 18
ActiveWindow.ScrollColumn = 19
ActiveWindow.ScrollColumn = 20
ActiveWindow.ScrollColumn = 21
ActiveWindow.ScrollColumn = 22
ActiveWindow.ScrollColumn = 21
ActiveWindow.ScrollColumn = 20
ActiveWindow.ScrollColumn = 19
ActiveWindow.ScrollColumn = 18
ActiveWindow.ScrollColumn = 17
ActiveWindow.ScrollColumn = 15
ActiveWindow.ScrollColumn = 14
ActiveWindow.ScrollColumn = 13
ActiveWindow.ScrollColumn = 12
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
Columns("B:B").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Range("B1").Select
ActiveCell.FormulaR1C1 = "Days"
Range("B7").Select
End Sub