Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 06-26-2020, 03:47 PM
Logit Logit is offline Clear Cell directly to right when cell to left changes value Windows 10 Clear Cell directly to right when cell to left changes value Office 2007
Expert
 
Join Date: Jan 2017
Posts: 591
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

.
This is one of many methods :

In the Sheet Module paste :

Code:
Option Explicit

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
   TestInRange
End Sub

In a Regular Module paste :

Code:
Option Explicit

Function InRange(Range1 As Range, Range2 As Range) As Boolean
' returns True if Range1 is within Range2
Dim InterSectRange As Range
    Set InterSectRange = Application.Intersect(Range1, Range2)
    InRange = Not InterSectRange Is Nothing
    Set InterSectRange = Nothing
End Function

Sub TestInRange()
    If InRange(ActiveCell, Range("H6:H81")) Then
        ' code to handle that the active cell is within the right range
        ActiveCell.Offset(0, 1).Value = ""
    Else
        Exit Sub
    End If
End Sub
Reply With Quote
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Retaining the left side space in table cell kumarjeyabalan Word Tables 2 08-17-2019 03:14 AM
Clear Cell directly to right when cell to left changes value Clear all cell colors within a range starting at cell A8 and change row of active cell to yellow FUGMAN Excel Programming 7 02-05-2017 08:37 AM
Clear Cell directly to right when cell to left changes value If value of cell A Matches a value in a Range of cells (column) then add value of cell A to cell C rick10r Excel 1 07-05-2016 12:07 PM
Clear Cell directly to right when cell to left changes value Assign the value of a cell as a cell reference of another cell in Excel 2010 - How to? bharathkumarst Excel 7 10-13-2014 10:25 AM
How do I align image at ABSOLUTE top left of a table cell? shnoozin Outlook 0 07-22-2011 03:30 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:09 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