View Single Post
 
Old 06-05-2015, 10:29 PM
excelledsoftware excelledsoftware is offline Windows 8 Office 2003
IT Specialist
 
Join Date: Jan 2012
Location: Utah
Posts: 455
excelledsoftware will become famous soon enough
Default

NoSparks, thanks so much for your contribution. I actually have never used intersect before and it really looks like the best way to write this out. I have taken your contribution and updated the worksheet module to something that works really well.

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  Dim Preview As Range, DataRange As Range
  
  'Set references
  Set Preview = Range("M1")
  Set DataRange = Range("E16:I18")

  'Ensure you are in the right area
  Application.EnableEvents = False
  If Intersect(Target, DataRange) Is Nothing Or Target.Cells.Count > 1 Then
    Application.EnableEvents = True
    Exit Sub
  Else
    Preview = Target.Value
  End If
 Application.EnableEvents = True
End Sub
Emma go ahead and replace the existing code with this one and then you can set the range and preview to whatever you want.

Thanks to both Charles and NoSparks for their help.
Reply With Quote