View Single Post
 
Old 06-04-2015, 11:08 AM
charlesdh charlesdh is offline Windows 7 32bit Office 2010 32bit
Expert
 
Join Date: Apr 2014
Location: Mississippi
Posts: 382
charlesdh is on a distinguished road
Default

HI,

Sorry to intrude. But, I modified the code. The data in the workbook started in row 16. And I add the 'Application Event"
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  Dim Preview As Range, BlankCol As Long, BlankRow As Long
  Dim StartRow As Long, StartCol As Long
  
  Set Preview = Range("M1") 'Set the reference you want
  
  'Set other references
   Application.EnableEvents = False '' Added
  StartRow = 16 ''' data started on row 16
  StartCol = 5
  'Auto set the boundaries
  BlankCol = Cells(StartRow, StartCol + 1).End(xlToRight).Column + 1
  BlankRow = Cells(StartRow, StartCol + 1).End(xlDown).Row + 1
 
  'Ensure you are in the right area
  If Target.Column < BlankCol And Target.Column > StartCol Then
    If Target.Row < BlankRow And Target.Row > StartRow Then
      Preview = Target.Value
    End If
  End If
 Application.EnableEvents = True ''' added
End Sub
Reply With Quote