Excel Macro

Hi,  

I have the macro below which I am trying to develop to help sort the excel file attached, the macro works but I would like the result to not show any 0 or – figures in column C (ORDER QUANTITY) is this possible?

Sub orderreport()
Dim sr As Boolean, i As Long, rng As Range
ActiveSheet.Copy
ActiveSheet.UsedRange.Cells.Value = ActiveSheet.UsedRange.Cells.Value
Range("J1:S1").EntireColumn.Delete
Range("C1:G1").EntireColumn.Delete
sr = Range("A3:A" & Rows.Count).Replace("SELECT", "")
Range("A3:A" & Rows.Count).SpecialCells(xlCellTypeBlanks).EntireRow.Delete
Set rng = Range("A3").CurrentRegion
sr = rng.Sort([a1], xlAscending)
For i = rng.Row + rng.Rows.Count To 3 Step -1
If Cells(i + 1, 1) <> Cells(i, 1) Then Cells(i + 1, 1).EntireRow.Insert
Next i
End Sub
 Order-data.xls
AlexAmblerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Shanan212Commented:
=IF((G4-F4)<=0,"",G4-F4)

Open in new window


Why not put the above in H4 cell in your Order-Data file? This would prevent any zeros and negative numbers.
0
Saqib Husain, SyedEngineerCommented:
Add this line after the For statement

If Cells(i, 3) <= 0.5 Then Cells(i, 3).EntireRow.Delete
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
[ fanpages ]IT Services ConsultantCommented:
How about adding this code line just before the "End Sub"?

Columns("C").NumberFormat = "0;"""";-0"

BFN,

fp.


Columns("C").NumberFormat = "0;"""";-0"

That is...

Sub orderreport()
Dim sr As Boolean, i As Long, rng As Range
ActiveSheet.Copy
ActiveSheet.UsedRange.Cells.Value = ActiveSheet.UsedRange.Cells.Value
Range("J1:S1").EntireColumn.Delete
Range("C1:G1").EntireColumn.Delete
sr = Range("A3:A" & Rows.Count).Replace("SELECT", "")
Range("A3:A" & Rows.Count).SpecialCells(xlCellTypeBlanks).EntireRow.Delete
Set rng = Range("A3").CurrentRegion
sr = rng.Sort([a1], xlAscending)
For i = rng.Row + rng.Rows.Count To 3 Step -1
If Cells(i + 1, 1) <> Cells(i, 1) Then Cells(i + 1, 1).EntireRow.Insert
Next i

  Columns("C").NumberFormat = "0;"""";-0"

End Sub

Open in new window

0
AlexAmblerAuthor Commented:
thank you.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.