I suspect this isn't all that complicated, but I'm not having much luck finding the right terms to Google... so I came to the experts!
So I'm trying to implement an Worksheet_Change
event. It's exceedingly simple, I basically just want to do the following:
If Value in Column C changes, and Value in D (in that row) has a specific formatting (NumberFormat = "$ 0.00") then Column E (in that row) is the product of those two values. Easy. Practically speaking, I just want the VBA equivalent of using a formula in the E column. This the code I'm using:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 3 And Target.Value <> "" Then
If Target.Offset(0, 1).NumberFormat = "$ 0.00" Then
Target.Offset(0, 2).Value = Target.Value * Target.Offset(0, 1).Value
End If
End If
end sub
My problem is popping up when I try to paste in multiple values into multiple rows of the c column. i.e. I'm copying a column of data (> 1 row) into C and I get a type mismatch error. I'll make the gigantic leap that it's not dealing with this well because "target" is intended to be a single cell as opposed to a group. I'm hoping there's a simple way to deal with this that doesn't involve some crazy loop every time a cell changes on the sheet or something.
Thanks in advance!