Using VBA to set cell values based on values in the same row

Swagner

New Member
Joined
Jan 2, 2019
Messages
6
Hey guys, need a little help here.

I'm working on a proposal sheet for a business and I want to add a button on the top that would let them reset the quantities all to 0. I have a "Description" column that has values such as header, product, description, and subtotal. Basically what I need is some VBA to set each row's quantity value to 0 if the "Description" column = product.

I've tried some things, but just can't get it to work.

Thanks all!
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Ok, try
Code:
Sub Swagner()
   Dim Lr As Long
   With ActiveSheet
      If .FilterMode Then .ShowAllData
      Lr = .Range("D" & Rows.Count).End(xlUp).Row
      .Range("A51:W" & Lr).AutoFilter 4, "Product"
      .Range("I52:I" & Lr).Value = 0
      .ShowAllData
   End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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