I am using this formula
=IF('Asset Maintenance'!R6="","",'Asset Maintenance'!R6)
in column D od sheet ‘Job Plan Tasks 2 of 3’. The problem is the data is moving to the cell below the actual cell. I believe it’s due to this macro.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim cut As Long
With Target
If .CountLarge > 1 Or .Row < 2 Then Exit Sub
On Error GoTo SOFTEXIT
Application.EnableEvents = False
If .Column = 17 Then
If Len(.Value) > 150 Then
cut = InStrRev(.Value, " ", 151)
If cut = 0 Then cut = 151
.Offset(0, 1) = Mid(.Value, cut)
.Value = Left(.Value, cut - 1)
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlTop
.WrapText = True
Else
.Offset(0, 1).ClearContents
End If
ElseIf .Column = 16 And IsNumeric(.Value) Then
'This is to auto-paste text in cell next to another cell with a certain value.
'Here if 1 then text and if 10 a different text
Select Case .Value
Case 1
.Offset(0, 1) = "**Did any work performed require any change that is not the exact replacement? If YES, contact your GL to initiate MOC 1+3**"
Case 10
.Offset(0, 1) = "FOLLOW ALL SAFETY AND LOCKOUT PROCEDURES"
End Select
End If
SOFTEXIT:
Application.EnableEvents = True
End With
End Sub
Any ideas?
Bookmarks