0
Sheets("SE Export").Activate 'calls active sheet
    LastSERow = Cells.Find(What:="*", After:=[A1], _
          SearchOrder:=xlByRows, _
          SearchDirection:=xlPrevious).Row
          Range("A7").Activate
          If ("A7") = 1 Then
          Range("A6").Activate 'Active column A6
         'On Error GoTo QS_MPN_Error
Cells.Find(What:="CPN").Activate
On Error GoTo 0
End If

ActiveCell.Offset(0, 0 - (ActiveCell.Column - 1)).Activate

            
    'End If
QSMapForm.Show


    Cells.Find(What:="Lifecycle").Activate 'Find lifecycle header
    ActiveCell.Offset(1, 0).Activate
Do
        
            If ActiveCell = "" Then  'Runs through each column for lifecycle status
            ActiveCell = "Unmatched Part"
        ElseIf InStr(ActiveCell, "Preliminary") Then 'If part is preliminary then change status to conditional
            ActiveCell = "Conditional Availability"
        ElseIf InStr(ActiveCell, "Obsolete") Then
            If InStr(ActiveCell.Offset(0, 3), "") Then
                ActiveCell = "Discontinued-W/Alternates"
            Else
                ActiveCell = "Discontinued-No Alternates"
            End If
        ElseIf InStr(ActiveCell, "LTB") Then
            ActiveCell.Offset(0, 8) = ActiveCell
            ActiveCell.Replace What:="LTB", Replacement:="", LookAt:= _
                xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
                ReplaceFormat:=False
            ActiveCell.Replace What:="(", Replacement:="", LookAt:= _
                xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
                ReplaceFormat:=False
            ActiveCell.Replace What:=")", Replacement:="", LookAt:= _
                xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
                ReplaceFormat:=False
            ActiveCell.Replace What:=Chr(10), Replacement:="", LookAt:= _
                xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
                ReplaceFormat:=False
            LTBdate = ActiveCell
            ActiveCell.Offset(0, 16) = LTBdate
            ActiveCell = "Life Time Buy"
        End If

'I receive the error while running the next line it does not like the value of "" for some reason. Loop While ActiveCell.Offset(0, -12).Value <> ""

'Error at the loop while with object defined, for the value of the next cell of "". ActiveCell.Offset(1, 0).Activate 'I receive the error while running the next line it does not like the value of "" for some reason. Code {Loop While ActiveCell.Offset(0, -12).Value <> ""}

dave
  • 1
  • 2
  • 1
    Probably you can't offset 11 columns to left of `ActiveCell`. – BigBen Oct 04 '21 at 15:58
  • 1
    `If ("A7") = 1 Then` will always return False. `A7` does not equal `1` – Scott Craner Oct 04 '21 at 16:00
  • I have not had an issue with running 12 columns to the left of the active cell before the error just started when upgraded to excel 2019 from 2017. – dave Oct 04 '21 at 16:30
  • Try `Debug.Print ActiveCell.Column` and examine the output in the Immediate Window. Might not be what you think it is. – BigBen Oct 04 '21 at 16:33
  • You might consider reading [this](https://stackoverflow.com/questions/10714251/how-to-avoid-using-select-in-excel-vba), which talks about avoid `Select` but is also applicable to avoiding `Activate` and `ActiveCell`. – BigBen Oct 04 '21 at 16:35
  • I have used the range to activate the Active Cell, and it will run through that point but now I receive Runtime error 1004 Application-defined or Object-defined error – dave Mar 14 '22 at 11:33
  • I have changed the code to Selecting the Active cell to Set Rng=Activesheet.Range("A1!"), this worked for selecting cell but now I receive Application Run Error while trying to Run Selection. Copy – dave Mar 14 '22 at 13:24

0 Answers0