0

Screenshot#1

So i have column "B" , i have to multiply an entire column to "x" number. For example it will be "10".

Here is my code:

Private Sub CommandButton3_Click() //= Multiply [screenshot#3]
Range("C2:C10").Value = Range("B2:B10").Value * 10
End Sub

I am getting error :Screenshot#2

Here is how looks my userform: Screenshot#3

  • `Range("B2:B10").Value` is a 2D Variant array... you can't multiply an array by 10. You could use `Copy/PasteSpecial Multiply`. Or loop. Or `Evaluate` maybe. – BigBen May 08 '20 at 18:28
  • I don't understand what u means –  May 08 '20 at 18:29
  • And how it will look in my code using copy or your other suggestions, i don't know how works code –  May 08 '20 at 18:31
  • `Private Sub CommandButton3_Click()` `Dim x As Long` `For x = 2 To 10` `Range("C" & x) = Range("B" & x).Value * 10` `Next x` `End Sub` – barvobot May 08 '20 at 18:32
  • Ok it works good, but how to multiply by a constant with input in textbox? –  May 08 '20 at 18:38
  • Try `* Textbox1.Value` – GMalc May 09 '20 at 05:37

0 Answers0