Change Negative Values to 0 in Column C only.

I need a snippet of code to add this to my current procedure, which is probably not efficient, but works.

Sub SubtractWellsNameSets()
' Subtract Wells & Rename choice sets

If Range("c3") = "" Then
MsgBox "All liquors must have a price, even if it is 0.00"
Exit Sub
End If
If Range("a3") = "" Then
MsgBox "You must first paste all your liquors in the worksheet."
Exit Sub
End If
    Range("G2").Copy
    Range("C3").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlSubtract, _
        SkipBlanks:=False, Transpose:=False
    Range("A3").Select

Range(ActiveCell, ActiveCell.End(xlDown)).Select
    For Each cell In Selection
        cell.Value = cell.Value & ": Sub"
    Next cell
    Range("A3:B3").Select
    Range(Selection, Selection.End(xlDown)).Copy
    Sheets("CreateChoiceSets").Select
'This needs to be the first blank cell in column M instead of M2
    Range("M" & Rows.Count).End(xlUp).Offset(1).Select
    'Range("M2").Select
    ActiveSheet.Paste
    Sheets("SubMaker").Select
    Range("B3:C3").Select
    Range(Selection, Selection.End(xlDown)).Copy
    Sheets("CreateChoiceSets").Select
'This needs to be the first blank cell in column E instead of E87
    Range("E" & Rows.Count).End(xlUp).Offset(1).Select
    'Range("E87").Select
    ActiveSheet.Paste
'Here, I am removing duplicates in column A
    Sheets("SubMaker").Select
    Range("A3").Select
   Range(Selection, Selection.End(xlDown)).RemoveDuplicates Columns:=1, Header:=xlNo
   Range("A3").Select
    Range(Selection, Selection.End(xlDown)).Copy
    Sheets("CreateChoiceSets").Select
'This needs to be the first empty cell in column A
    Range("A" & Rows.Count).End(xlUp).Offset(1).Select
    ActiveSheet.Paste
    Range("A2").Select
    
    Call ResetCondFormatsChoiceSets
End Sub

Open in new window

LVL 22
Anne TroyEast Coast ManagerAsked:
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.

Rory ArchibaldCommented:
You could use:

range("C:C").Replace "-*", 0

Open in new window

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
Saurabh Singh TeotiaCommented:
In the line number--20 to 22:

where you have this..

For Each cell In Selection
        cell.Value = cell.Value & ": Sub"
    Next cell

Open in new window


Change this to this...

For Each cell In Selection
        cell.Value = cell.Value & ": Sub"
        If cell.Offset(0, 2).Value < 0 Then cell.Offset(0, 2).Value = 0
    Next cell

Open in new window


Saurabh...
Rob HensonFinance AnalystCommented:
Or even:

cell.Value = cell.Value & ": Sub"
cell.offset(0,2).Value = Max(cell.offset(0,2).value,0)

Thanks
Rob H
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.