Mismatch Error

MarkPuglia

New Member
Joined
Aug 16, 2016
Messages
2
been tinkering with this for hours, any advice of what the mismatch might be coming from

Code:
Private Sub CommandButton1_Click()With ThisWorkbook.Worksheets("Elix2 Custom Systems")
    Set rngData = .Range("G13:G29")
    Set rngNum = .Range("C8")
      rngData = rngData * rngNum
End With
End Sub
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
I assume you are getting that error on this line:

rngData = rngData * rngNum

Can you explain what you want to accomplish with that line? Are you trying to multiply the value of each cell in rngData by the value in the cell rngNum?
 
Upvote 0
Yes thats the line. And its just taking the value from one cell (rngNum) and multiplying that into the entire range of the (rngData) so that when they pick the value in a drop down for the rngNum it will automatically multiply the rngData that the user originally entered by that number
 
Upvote 0
Yes thats the line. And its just taking the value from one cell (rngNum) and multiplying that into the entire range of the (rngData) so that when they pick the value in a drop down for the rngNum it will automatically multiply the rngData that the user originally entered by that number
Try it like this:
Code:
Set rngdata = .Range("G13:G29")
    Set rngNum = .Range("C8")
    For Each c In rngdata
      c.Value = c.Value * rngNum.Value
    Next c
 
Upvote 0
A different method of doing it with no loops:
Code:
    Sheets("Elix2 Custom Systems").Activate
    Range("C8").Copy
    Range("G13:G29").PasteSpecial Paste:=xlPasteAll, Operation:=xlMultiply, _
        SkipBlanks:=False, Transpose:=False
 
Upvote 0

Forum statistics

Threads
1,215,823
Messages
6,127,064
Members
449,357
Latest member
donna_koenig

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top