Good morning to all,
I have the following VB code inserted in my sheet(5). I am trying to come up with a complex code that will change the value text in my code but only at a certain location:
If Not Intersect(Target, Range("Q:Q")) Is Nothing Then
If Target.Cells.Count = 1 Then ' stops the code looping
If LCase(Trim(Target.Value)) = "term" Then
Msg = MsgBox("Select Yes if another contract will be awarded" & vbNewLine & _
vbNewLine & "Select No if no contract will be awarded" & vbNewLine & _
vbNewLine & "Select Cancel to exit", _
vbYesNoCancel + vbQuestion + vbSystemModal, "Termination of Contract. Continue?")
If Msg = vbYes Then
Target.Offset(1, 0).EntireRow.Insert
Cells(Target.Row, 18).Value = Cells(Target.Row, 13).Value & "/T01"
Range("Q" & Target.Row).ClearContents
Range("A" & Target.Row + 1).Resize(, 15).Value = Range("A" & Target.Row).Resize(, 15).Value
Range(Cells(Target.Row, 1), Cells(Target.Row, 24)).Copy
Sheets("Archives").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
Application.EnableEvents = False
Range(Cells(Target.Row, 1), Cells(Target.Row, 25)).ClearContents
Rows("5:10000").Select
ActiveWorkbook.Worksheets("Report").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Report").Sort.SortFields.Add Key:=Range( _
"A5"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Report").Sort
.SetRange Range("A5:Y10000")
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Application.EnableEvents = True
Else
'If "No" is selected from the popup menu then it will cancel the popup msg and delete the selection in column M
Cells(TRow, TCol) = ""
End If
I have 3 codes based on the answer that the user will select. Two of them are completed.
If the user select "Yes" from the msgbox it will insert an entire row, copy what is in the Target.Row in column M and add it to my column R with /T01.
I need the code that is already performing an offset to change that value of the new row that will be created to change the value in the next row in column M. But the problem is I need to change the value of the text but just a certain location in the text.
Example:
If my target row column M is Test/001/HS, I need the new "Target.Offset(1, 0).EntireRow.Insert" to change the value of the Test/001/HS to Test/002/HS.
Explanation in detail:
Target row (column M = Test/001/HS) if the user select the validation list in Target row (column Q) the "term" option then to run the code above but the next row (The inserted row) the Target row (column M = Test/001/HS) will become Test/002/HS).
If someone could guide me or help me to figure out this code it would be appreciated
Bookmarks