ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,832
- Office Version
- 2007
- Platform
- Windows
Hi,
I have two columns A & B of which i need each sorted separatley from low to high numbers.
This worked fine.
It sorted column A from 1-100 perfect then it sorted column B 1-22 perfect.
So i then added it to my code which populates these two columns but i then get a RTE 1004 please see screenshot.
This is the code i added it to.
I run the code & columns A & B are populated.
The code sorts column A2 & down the page from 1-100 etc & at this point column B is untouched.
Once done the code sorts column B2 & down the page from 1 -50 etc & at this point column A is untouched.
Please advise as none of the cells are merged
I have two columns A & B of which i need each sorted separatley from low to high numbers.
This worked fine.
Rich (BB code):
Private Sub SortFrameNumbers_Click()
Range("A2:A150").Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlNo
Range("B2:B50").Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlNo
End Sub
So i then added it to my code which populates these two columns but i then get a RTE 1004 please see screenshot.
This is the code i added it to.
Rich (BB code):
Private Sub GoldWingCountry_Click()
Dim Cell As Range
Dim wsMC As Worksheet
Dim wsCountry As Worksheet
Set wsMC = Sheets("MCLIST")
Set wsCountry = Sheets("COUNTRYLIST")
With Sheets("COUNTRYLIST")
.Range("A2:B1000").ClearContents
End With
wsCountry.Range("A1") = "GOLD WING UK"
wsCountry.Range("B1") = "GOLD WING USA"
With wsMC
For Each Cell In .Range("D8:D" & .Cells(.Rows.Count, "D").End(xlUp).Row)
If Cell.Value = "GOLD WING UK" Then
wsCountry.Range("A" & Rows.Count).End(xlUp).Offset(1) = Cell.Offset(, -2)
ElseIf Cell.Value = "GOLD WING USA" Then
wsCountry.Range("B" & Rows.Count).End(xlUp).Offset(1) = Cell.Offset(, -2)
End If
Next Cell
End With
Sheets("COUNTRYLIST").Select
Range("A2:A150").Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlNo
Range("B2:B50").Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlNo
End Sub
I run the code & columns A & B are populated.
The code sorts column A2 & down the page from 1-100 etc & at this point column B is untouched.
Once done the code sorts column B2 & down the page from 1 -50 etc & at this point column A is untouched.
Please advise as none of the cells are merged