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

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
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,224,825
Messages
6,181,191
Members
453,021
Latest member
pingpong7117

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