Good afternoon,
I have the cell selected and now I want to get the value of that selected cell and subtract it from the value of the combobox and then pick up that result and put it in the selected cell.
So far I've made this part of the code:
Private Sub Btn_Eliminar_Click()
Dim I As Long
Dim myvar As Integer
Dim comvar As Integer
Dim resultado As Integer
For I = 3 To Folha2.Range("C65536").End(xlUp).Row
myvar = Range("C" & I).Value
comvar = Total_Stock.Value
resultado = myvar - comvar
Range("C" & I).Select
ActiveCell.FormulaR1C1 = resultado
Next I
End Sub
I assigned the value of the selected cell to the variable myvar and the value of the combobox to the comvar variable, and then I created the result variable to get the desired value. So far so good, but after putting the value in the cell changes me the value of several cells and not only the selected cell, can someone help me?
At this point I know what the problem is, but I still do not know how to solve it. The problem is that I am not assigning the value of the cell to the variable myvar, this variable is 0, so it gives me the negative number with the value that I assign to the variable comvar.