mardi 27 juillet 2021

VBA - how do I change values in table according to conditions [closed]

I have this table with some categories like product('produto'), and type ('tipo') of entry.

I plan to create a button (using macro) to update some entries depending of the type.

Like, if type = "ESTIMATIVA", then apply in column 'QUANTIDADE' the formula (as example for cell E20):

=LOOKUP(2;1/((($F$2:F19="CONTAGEM")+($F$2:F19="ESTIMATIVA"))*($A$2:A19=A20));$E$2:E19)+IF(F20="CONTAGEM";0;IF(F19="ENTRADA";E19;IF(F19="SAIDA";-E19)))

I would like to apply this formula to the whole 'QUANTIDADE' column in table 'EST_2'.

Image for example of the table I'm using.

enter image description here

I simply have no idea how to do that. Been studying by myself here for couple of months and getting better, but still can't find a way to solve this problem.

Can someone help me or any tips?

Aucun commentaire:

Enregistrer un commentaire