looking to get suggestions to improve the coding I have for a module.
I finally got the code to run the way I need it to today.
The issue is it is brute force and can only be ran once.
Sub CopyOffset()
Dim r As Range
Dim c As Range
Dim max_col As Long
max_col = ActiveSheet.UsedRange.Columns.Count
Range("M4").End(xlUp).Select
Do Until IsEmpty(ActiveCell)
If Left(ActiveCell.Value, 2) = "RS" Then
Set r = Rows(ActiveCell.Row)
For Each c In r.Cells
'copy the value of each cell in the row to new location
If c.Column = 0 Then
'skip if value = 0
ElseIf c.Column <= max_col Then
' Action
ActiveCell.Select
ActiveCell.Copy
Cells.Find(What:="Rotor/Shaft Assy", After:=ActiveCell, LookIn:=xlValues _
, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Offset(0, 2).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Cells.Find(What:="RS-", After:=ActiveCell, LookIn:=xlValues _
, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Else
Exit For
End If
Next c
End If
Loop
End Sub
Bookmarks