WorkSheet_Change(ByVal Target As Range)

itsme2

Board Regular
Joined
Jul 29, 2006
Messages
66
I have several lines on code on this worksheet however I am having trouble getting the second line of the below to work

I only want it to display a message box if the counts in the rc -1 is greater than 1

Code:
WorkSheet_Change(ByVal Target As Range)

If Target.Column = 1 And Target.Cells.Count = 1 Then
 
Cells(Target.Row, 4).FormulaR1C1 = "=IF(RC[-3] > 1, COUNTIF(C[-3],RC[-3]),"""")"
    'Cells(Target.Row, 5).FormulaR1C1 = "=IF(RC[-1] > 1, (MsgBox "Try", vbCritical),"""")

End If

End Sub
[code]

How do I access this message box when contents of column "c" are greater then 1 using the countif statment?

 :-?
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Not sure what you really want to do.
Since you're targeting on columnA, simply
Code:
WorkSheet_Change(ByVal Target As Range)

If Target.Column = 1 And Target.Cells.Count = 1 Then
 
Cells(Target.Row, 4).FormulaR1C1 = "=IF(RC[-3] > 1, COUNTIF(C[-3],RC[-3]),"""")"
If Target.Value > 1 Then MsgBox("Try", vbCritical)

End If

End Sub
 
Upvote 0

Forum statistics

Threads
1,203,760
Messages
6,057,204
Members
444,914
Latest member
Mamun12345

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