Sub Macro6()
'
'
'
ActiveCell.FormulaR1C1 = "12345"
Columns("A:A"). Selec
Sub Macro6()
'
' Macro6 Macro
'
'
ActiveCell.FormulaR1C1 = "12345"
Columns("A:A").Select
Selection.Copy
Range("AF1").Select
ActiveSheet.Paste
Range("AF1").Select
Application.CutCopyMode = False
Selection.AutoFilter
Set ws = Sheets(1)
If ws.AutoFilterMode = True Then '//Si hay filtro aplicado lo quita...
ws.AutoFilterMode = False
End If
'//Aplica autofiltro...
ws.Range("$B$2:$D$" & ws.Cells.Rows.Count).AutoFilter Field:=1, Criteria1:=sCriterio, VisibleDropDown:=False
'//Toma rango del Autofiltro
Set Rng = ws.AutoFilter.Range '//Ej: $B$2:$D$13
If Not Rng Is Nothing Then
'//Reduce el rango del Autofiltro (quita encabezado)
'//(toma sólo la primer columna del rango del Autofiltro)
sAdd = Rng.Address
stmp = Split(sAdd, ":")(0) '//$B$2
stmp = Split(stmp, "$")(2) '//2
sFirst = Split(sAdd, "$")(1) '//B
sLast = Split(Cells(, Rng.SpecialCells(xlCellTypeLastCell).Column).Address, "$")(1)
sAdd = Replace(sAdd, sLast, sFirst) '// $B$3:$D$13 -> $B$3:$B$13
sAdd = Replace(sAdd, "$" & sFirst & "$" & stmp, "$" & sFirst & "$" & CStr(CLng(stmp) + 1))
Set Rng = Range(sAdd)
'//Resultado del Autofiltro (filas visibles)
Set h = Rng.SpecialCells(xlCellTypeVisible)
End If
Field:=1, Criteria1:=Array( _
"1-CROSS DOCK CULIACAN 748", _
"Item UPC: Slot/Door: Country Code: MX - Mexico Grid: Shipping Lane:" _
, "Label Information", _
"Load No: Trip No: Destination: Label Number:" _
, "Reporting Tool Version #2014.6.29.1200", "Sub Center"), Operator:= _
xlFilterValues
Range("AF2").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
Range("AF1").Select
Selection.AutoFilter
Columns("AF:AF").Select
Selection.TextToColumns Destination:=Range("AF1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=True, Other:=False, FieldInfo _
:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), _
Array(7, 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1 _
), Array(14, 1)), TrailingMinusNumbers:=True
Columns("AF:AF").Select
Selection.Delete Shift:=xlToLeft
Selection.Delete Shift:=xlToLeft
Selection.Delete Shift:=xlToLeft
Selection.Delete Shift:=xlToLeft
Selection.Delete Shift:=xlToLeft
Selection.Delete Shift:=xlToLeft
Selection.Delete Shift:=xlToLeft
Selection.Delete Shift:=xlToLeft
Selection.Delete Shift:=xlToLeft
Selection.Delete Shift:=xlToLeft
Selection.Delete Shift:=xlToLeft
Columns("AG:AH").Select
Selection.Delete Shift:=xlToLeft
Range("AF2").Select
Selection.Insert Shift:=xlDown
Selection.Insert Shift:=xlDown
Selection.Insert Shift:=xlDown
Selection.Insert Shift:=xlDown
Selection.Insert Shift:=xlDown
Range("A1").Select
Selection.AutoFilter
Set ws = Sheets(1)
If ws.AutoFilterMode = True Then '//Si hay filtro aplicado lo quita...
ws.AutoFilterMode = False
End If
'//Aplica autofiltro...
ws.Range("$B$2:$D$" & ws.Cells.Rows.Count).AutoFilter Field:=1, Criteria1:=sCriterio, VisibleDropDown:=False
'//Toma rango del Autofiltro
Set Rng = ws.AutoFilter.Range '//Ej: $B$2:$D$13
If Not Rng Is Nothing Then
'//Reduce el rango del Autofiltro (quita encabezado)
'//(toma sólo la primer columna del rango del Autofiltro)
sAdd = Rng.Address
stmp = Split(sAdd, ":")(0) '//$B$2
stmp = Split(stmp, "$")(2) '//2
sFirst = Split(sAdd, "$")(1) '//B
sLast = Split(Cells(, Rng.SpecialCells(xlCellTypeLastCell).Column).Address, "$")(1)
sAdd = Replace(sAdd, sLast, sFirst) '// $B$3:$D$13 -> $B$3:$B$13
sAdd = Replace(sAdd, "$" & sFirst & "$" & stmp, "$" & sFirst & "$" & CStr(CLng(stmp) + 1))
Set Rng = Range(sAdd)
'//Resultado del Autofiltro (filas visibles)
Set h = Rng.SpecialCells(xlCellTypeVisible)
End If
.AutoFilter Field:=1, Criteria1:=Array( _
"Item UPC: Slot/Door: Country Code: MX - Mexico Grid: Shipping Lane:" _
, "Label Information", _
"Load No: Trip No: Destination: Label Number:" _
, "Reporting Tool Version #2014.6.29.1200"), Operator:=xlFilterValues
Range("A2").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Delete Shift:=xlUp
Selection.AutoFilter
Selection.End(xlUp).Select
Selection.AutoFilter
Set ws = Sheets(1)
If ws.AutoFilterMode = True Then '//Si hay filtro aplicado lo quita...
ws.AutoFilterMode = False
End If
'//Aplica autofiltro...
ws.Range("$B$2:$D$" & ws.Cells.Rows.Count).AutoFilter Field:=1, Criteria1:=sCriterio, VisibleDropDown:=False
'//Toma rango del Autofiltro
Set Rng = ws.AutoFilter.Range '//Ej: $B$2:$D$13
If Not Rng Is Nothing Then
'//Reduce el rango del Autofiltro (quita encabezado)
'//(toma sólo la primer columna del rango del Autofiltro)
sAdd = Rng.Address
stmp = Split(sAdd, ":")(0) '//$B$2
stmp = Split(stmp, "$")(2) '//2
sFirst = Split(sAdd, "$")(1) '//B
sLast = Split(Cells(, Rng.SpecialCells(xlCellTypeLastCell).Column).Address, "$")(1)
sAdd = Replace(sAdd, sLast, sFirst) '// $B$3:$D$13 -> $B$3:$B$13
sAdd = Replace(sAdd, "$" & sFirst & "$" & stmp, "$" & sFirst & "$" & CStr(CLng(stmp) + 1))
Set Rng = Range(sAdd)
'//Resultado del Autofiltro (filas visibles)
Set h = Rng.SpecialCells(xlCellTypeVisible)
End If
.AutoFilter Field:=1, Criteria1:= _
"=*time*", Operator:=xlAnd
Range("A2").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Delete Shift:=xlUp
Selection.AutoFilter
Selection.End(xlUp).Select
Rows("1:1").Select
Selection.Delete Shift:=xlUp
Columns("D:D").Select
Selection.Delete Shift:=xlToLeft
Columns("E:E").Select
Selection.Delete Shift:=xlToLeft
Columns("I:O").Select
Selection.Delete Shift:=xlToLeft
Columns("L:U").Select
Selection.Delete Shift:=xlToLeft
Range("A1").Select
ActiveWindow.SmallScroll Down:=-36
End Sub