• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Update Cells in Range Based on Condition, within same worksheet

gvs

New Member
Greetings,
I would appreciate your help with VBA Code for the following requirement

- This is all within the same worksheet
- If value in cell D2 = 1, then Copy value from Cell B2 and Paste into Cell C2
- If value in cell D2 = 0; skip row and do not update cells C2
- Go through the entire range until all rows are checked and cells in C are updates as needed
- Need to exclude header row 1 and subtotal row at the end of the range

Expense (Col A)OriginalTax (Col B)NewTax (Col C)Variance (Col D)
Exp1
5.74​
5.74​
0​
Exp2
4.56​
2.1​
1​
Exp3
12.34​
12.43​
1​
Exp4
10​
9​
1​
Exp5
9​
9​
0​
Exp6
8​
8​
0​
Exp7
7​
7​
0​
Exp8
4​
3​
1​
Exp9
3​
2​
1​
Exp10
5​
5​
0​
SUBTOTAL
68.64​
63.27​
 
gvs
Please, next time upload a sample Excel-file.
Here, a sample code.
 

Attachments

  • gvs.xlsb
    13.8 KB · Views: 2
gvs
Please, next time upload a sample Excel-file.
Here, a sample code.
Hello vletm,
Thank you for the reply, but unable to see the sample code in your xlsb workbook. Attached is my sample workbook; I would appreciate if you can add the code in it.

Kind Regards,
gvs
 

Attachments

  • MacroWBKforTax.xlsm
    10.7 KB · Views: 0
nevermind...found it and it works!!! thank you so very much!!!
Appreciate your help.

Happy New Year!!
gvs
 
Back
Top