erutherford
Active Member
- Joined
- Dec 19, 2016
- Messages
- 453
Should be pretty simple stuff, but I have run out of possibilities.
The code sorts data in Column I, first in an ascending order, then allows me to print the results, then resorts in descending order by Column A, putting it back to its original order.
Here is the code
<code>
Private Sub CommandButton3_Click() 'Print by Divison
Range("A3:I52").Sort Key1:=Range("I1"), Order1:=xlAscending, Header:=xlYes
Range("A3:I52").PrintPreview
Range("A3:I52").Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlYes
End Sub
</code>
The problem: its sorts everything but the first record (A3).
Column A are numbers, all have the same properties
Column I are text, all have the same properties
As you can see column "I" is not a 1 in the code.
thoughts?
The code sorts data in Column I, first in an ascending order, then allows me to print the results, then resorts in descending order by Column A, putting it back to its original order.
Here is the code
<code>
Private Sub CommandButton3_Click() 'Print by Divison
Range("A3:I52").Sort Key1:=Range("I1"), Order1:=xlAscending, Header:=xlYes
Range("A3:I52").PrintPreview
Range("A3:I52").Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlYes
End Sub
</code>
The problem: its sorts everything but the first record (A3).
Column A are numbers, all have the same properties
Column I are text, all have the same properties
As you can see column "I" is not a 1 in the code.
thoughts?