0
Good afternoon,
I have the selected cell and now I want to take the value of that selected cell and subtract it from the combobox value and then take that result and put it into the selected cell.
So far I’ve done 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 myvar variable and the value of the combobox to the variable comvar and then created the result variable to get the desired value. So far so good, but then by putting the value in the cell changes the value of several cells and not only the selected cell, someone can help me?
Right now I know what the problem is, but I still don’t know how to fix it. The problem is that I am not assigning the cell value to the myvar variable, this variable is 0, so it gives me the negative number with the value I assign to the variable comvar.
Good morning, I’ve already solved the problem. Thank you for trying to help me
– user77403