I Need Help Vba Code Automatically Sort Rows Large To Small By Data In Column D
I Need Help Vba Code Automatically Sort Rows Large To Small By Data In Column D
First record a macro of you manually doing the sort, then post the macro code here do we can help you clean it up and refine it.
you download book1s.xlsx
I did.
You record macro
Hi SamT
i have this macro you can edit it
this macro skip cells 0
i need also sort data large to small
i hope you can help me
[VBA]Private Sub Hide_Unhide()
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
For i = 7 To 111
Rows(i).Hidden = (Cells(i, "J").Value = 0) + (Cells(i, "b").Value = "")
Next i
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub[/VBA]
Last edited by Aussiebear; 03-19-2013 at 03:27 PM. Reason: Added the correct tags to the supplied code
What is the range of the entire table you need sorted?
Example Answer: A7 to J111
Sort Large To Small By Data In Column D
[VBA]Private Sub Hide_Unhide()
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
For i = 4 To 500
Rows(i).Hidden = (Cells(i, "D").Value = 0) + (Cells(i, "F").Value = "")
Next i
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub[/VBA]
Last edited by Aussiebear; 03-19-2013 at 03:28 PM. Reason: Added the correct tags to the supplied code
Sort what?
What is the range of the entire table you need sorted?
Example Answer: A7 to J111
Samt please download book1macroOriginally Posted by SamT
I need Sort data in column D large to small
[VBA]
Range("A3111").Sort.( _
Key1:=Range("D3"), _
Order1:= xlDescending, _
Header:= xlNo)
[/VBA]
is impossible sort data in column D ?
Last edited by etheer; 03-18-2013 at 04:46 PM.
thank you SamTOriginally Posted by SamT
you can edit book1macro.xlsx and upload it agian
plases
[vba]Range("D").Sort.( _
Key1:=Range("D1"), _
Order1:= xlDescending, _
Header:= xlGuess) [/vba]
how use this code in book1macro.xlsm ?Originally Posted by SamT
You need to start using the help files. In VBA, put the cursor in a word you want help on and press F1.
You might get better help by using the Non English Help Forum.
[vba]Private Sub Hide_Unhide()
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
For i = 4 To 500
Rows(i).Hidden = (Cells(i, "D").Value = 0) + (Cells(i, "F").Value = "")
Next i
'Sorting only one column of a table will mess up the table.
'Change "D" to refelect the entire table.
Range("D").Sort _
Key1:=Range("D1"), _
Order1:=xlDescending, _
Header:=xlGuess
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub
[/vba]
There's a couple of good points that arise out of this thread that need to be made.
Firstly, simply by demanding that others download a workbook from the forum to solve an issue is not good ethics. There's a risk involved when downloading and opening a workbook from someone you don't know or yet trust.
Secondly, the underlying concept of the forum is to assist others to learn the VBA language and its usage, through both the offerings of sections of code, and or the request to supply a section of code that has been self produced.
Thirdly, all offers to assist are done by volunteers who give freely of their time. So to make the most of these offers, one needs to be prepared to make the issue as clear as possible by definition. Provide workbooks with working samples of data and provide examples of what has been tried. Then those wanting to assist are in a better position to work on a solution.
Remember To Do the Following....
Use [Code].... [/Code] tags when posting code to the thread.
Mark your thread as Solved if satisfied by using the Thread Tools options.
If posting the same issue to another forum please show the link
Thank you, mod.
Originally Posted by SamT
Thank you so much SamT