ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,199
- Office Version
- 2007
- Platform
- Windows
I have a code on a worksheet which i would like to use on another sheet.
I changed the range etc to suit the new sheet but the sheet just ended up in a right mess when i run it.
The sheet i need the sort code on has this info for you.
Sheet name CLONING
Row 2 is headers.
Row 3 is hidden.
Values then start in row 3
The columns in use are D-I
The values in column D of which i need to sort are numbers & letters,low number to high number
So i used the code below where i changed the following
A5:Q to D3:I
Sheet name DATABASE to CLONING
=Range & .Range A6 to =Range & .Range to D4
I changed the range etc to suit the new sheet but the sheet just ended up in a right mess when i run it.
The sheet i need the sort code on has this info for you.
Sheet name CLONING
Row 2 is headers.
Row 3 is hidden.
Values then start in row 3
The columns in use are D-I
The values in column D of which i need to sort are numbers & letters,low number to high number
So i used the code below where i changed the following
A5:Q to D3:I
Sheet name DATABASE to CLONING
=Range & .Range A6 to =Range & .Range to D4
Code:
Private Sub ChipSortSort_Click() Dim x As Long
Application.ScreenUpdating = False
With Sheets("DATABASE")
If .AutoFilterMode Then .AutoFilterMode = False
x = .Cells(.Rows.Count, 1).End(xlUp).Row
.Range("A5:Q" & x).Sort key1:=Range("A6"), order1:=xlAscending, Header:=xlGuess
End With
ActiveWorkbook.Save
Application.ScreenUpdating = True
Sheets("DATABASE").Range("A6").Select
End Sub