Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 06-02-2015, 05:30 PM
excelledsoftware excelledsoftware is offline Carbon Footprint Calculator problem Windows 8 Carbon Footprint Calculator problem Office 2003
IT Specialist
 
Join Date: Jan 2012
Location: Utah
Posts: 455
excelledsoftware will become famous soon enough
Default

Ok This attempts to set up the range of where the cursor can return a value and where it should be ignored. The line says Set Preview is where you change the preview cell in between the quotes.

You need to insert this code into the worksheet module. To do so open your workbook, press ALT + F11, on the left side of the new screen you will see VBAProject followed by your workbook name. Double click the sheet below that has the data and then paste the following code in.

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
  StartRow = 2
  StartCol = 1
  '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
 
End Sub
Let me know if you have any questions.

Thanks
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Carbon Footprint Calculator problem Result Calculator Raza Excel Programming 7 01-26-2015 11:35 PM
Excel Calculator Mandusin Excel 6 12-25-2010 07:34 AM
Age Calculator in MS Outlook 2002 SP3 turns Outlook 0 06-15-2010 12:26 AM
**FIND OUT WHO WAS BCC(BLIND CARBON COPIED) ON YOUR EMAILS?? sharpescalade Outlook 1 11-30-2006 08:07 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:55 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft