Can you check my code please

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,226
Office Version
  1. 2007
Platform
  1. 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


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
 
It would of been easier to just supply the code as you might have seen i was having issues
But no i get taken on a mine field where i end up giving in as i need to work out the reply before i even get to trying to sort of the code.
 
Upvote 0

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
@ipbr21054, test the code below and report back your findings/results....

Code:
    Dim x As Long
    With Sheets("CLONING")
        If .AutoFilterMode Then .AutoFilterMode = False
        x = .Columns("D:I").Find("*", , xlValues, , xlByRows, xlPrevious).Row
        .Range("D4:I" & x).Sort key1:=.Range("D4"), order1:=xlAscending, Header:=xlNo
    End With
 
Upvote 0

Forum statistics

Threads
1,214,981
Messages
6,122,565
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top