Adrian Low
New Member
- Joined
- Apr 30, 2019
- Messages
- 23
[FONT="]Hi I have two questions.[/FONT]
<code style="box-sizing: inherit; font-family: Consolas, "Courier New", Courier, monospace; font-size: 1em; border: 0px; margin: 0px; padding: 0px; vertical-align: top; -webkit-font-smoothing: antialiased; text-size-adjust: none;"> Set wsInput = Workbooks("InputB.xls").Worksheets("HC_MODULAR_BOARD_20180112")
Set wsOutput = Workbooks("Output.xls").Worksheets("Sheet1")
Set Ws2 = Workbooks("InputA.xls").Worksheets("Sheet0")
With wsInput
'Error starts from here
wsInput.Range("F3:F").AutoFilter Criteria1:="="
wsInput.Range("F3:F").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
wsInput.ShowAllData
LastRow = wsInput.Cells(wsInput.Rows.Count, "E").End(xlUp).Row
Rows("3:LastRow").Select
.Sort.SortFields.Clear
.Sort.SortFields.Add Key _
:=Range("E3:LastRow"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption _
:=xlSortNormal
With wsInput.Sort
.SetRange Range("A2:LastRow")
.header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
</code>[FONT="]I believe my sorting have some issues too please let me know if any of you see any mistakes.
[/FONT]
[FONT="]Many thanks,[/FONT]
[FONT="]Adrian[/FONT]
- Create filter to find any blanks cells and delete the entire row with it after which show all data
- Sort in one of the input on Range("E3:E") from A to Z
<code style="box-sizing: inherit; font-family: Consolas, "Courier New", Courier, monospace; font-size: 1em; border: 0px; margin: 0px; padding: 0px; vertical-align: top; -webkit-font-smoothing: antialiased; text-size-adjust: none;"> Set wsInput = Workbooks("InputB.xls").Worksheets("HC_MODULAR_BOARD_20180112")
Set wsOutput = Workbooks("Output.xls").Worksheets("Sheet1")
Set Ws2 = Workbooks("InputA.xls").Worksheets("Sheet0")
With wsInput
'Error starts from here
wsInput.Range("F3:F").AutoFilter Criteria1:="="
wsInput.Range("F3:F").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
wsInput.ShowAllData
LastRow = wsInput.Cells(wsInput.Rows.Count, "E").End(xlUp).Row
Rows("3:LastRow").Select
.Sort.SortFields.Clear
.Sort.SortFields.Add Key _
:=Range("E3:LastRow"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption _
:=xlSortNormal
With wsInput.Sort
.SetRange Range("A2:LastRow")
.header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
</code>[FONT="]I believe my sorting have some issues too please let me know if any of you see any mistakes.
[/FONT]
[FONT="]Many thanks,[/FONT]
[FONT="]Adrian[/FONT]