Run-time error 13 Type Mismatch

dosborn

New Member
Joined
Dec 21, 2011
Messages
12
Thank you in advance for any help. I am getting a run-time error 13 type mismatch and can not figure it out. Below are the two macros I am running:

Private Sub Worksheet_Change(ByVal Target As range)
If Intersect(Target, range("D11:D34")) Is Nothing Then
Exit Sub
Else
Call PartBalance
End If
End Sub
_______________________________________________________

Sub PartBalance()

With Sheets("REQUEST")

If range("D11:D34").Value - range("K11:K34").Value <> 0 Then

range("B11:B34").Copy Sheets("REQUISITION").range("M11:M22,M31:M42")
range("E11:E34").Copy Sheets("REQUISITION").range("E11:E22,E31:E42")
range("H11:H34").Copy Sheets("REQUISITION").range("H11:H22,H31:H42")

End If

End With


Thank you again for any help.
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Have you declared a variable with the name 'range'?

Or called a sub/module 'range'?
 
Upvote 0
The reason I ask is because in the posted code range is in lower case.

It should be in proper case, Range.

However that's not the problem.

The problem is in the sub you are calling.

You can't do this.
Code:
If range("D11:D34").Value - range("K11:K34").Value <> 0 Then
You can't subtract 2 ranges like this.

What is it you actually want to subtract anyway?
 
Upvote 0
It is quantity of parts to order and I need to determine if parts were pulled from stock and partial filled so K11 through K34 is greater than zero it will prompt me to order parts.
 
Upvote 0
Do you mean if the sum of K11 to K34 is more than 0 or if any of the values in the range are greater than 0?

Also, where does the other range, D11:D34, come into it?
 
Upvote 0
Sorry about that.
Column D is the number of parts requested.
Column K is the number of parts handed out.

So if (D)-(K) is greater than 0 i need the macro to prompt me.

I have it working for a single row 11, but I need to incorporate rows 12 through 34.

Thanks for the help.
 
Upvote 0

Forum statistics

Threads
1,214,919
Messages
6,122,259
Members
449,075
Latest member
staticfluids

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