Troubleshooting a worksheet selectionchange macro

svmac

Board Regular
Joined
Feb 16, 2002
Messages
182
I have the following macro in my worksheet module;

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Dim TestRange As Range
Set TestRange = Range("$H$2:$H$500")
If Not Intersect(Target, TestRange) Is Nothing Then
If Target.Value = "Yes" Then
Target.EntireRow.PrintOut Copies:=2
End If
End If
Set TestRange = Nothing
End Sub

Instead of looking at the target value, as the user will be entering yes then leaving the cell, I wish to have the macro look at the value of the cell it is leaving.

If anyone can help me out, I would greatly appreciate it.

Thnx
 
Hi.
Short on time here.
Search "PreviousSelections Property Example" in VBA help. You will need to take into account that this property will be empty when the workbook is initially opened.
Tom
 
Upvote 0
Thnaks for replying TsTom.

I have had a look at the help file as suggested, but am not sure how to apply this to my code.

In my mind, I think I can see how this should work, but in my worksheet, I cannot apply it.

Any further suggestions appreciated.

Thnx
Stuart
 
Upvote 0

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