I am writing a code to input data that is seen on other rows, it works until their is a blank row and then it will not add any data permanently passed the blank row. The basic excel I am using to practice my code
My code works for everything above the blank and with ghost put the numbers in but won't permanently input the data. My code is below, if you have any input on what could be wrong or what needs to be added I would really appreciate it.
Sub Find_Part()
Dim Part_Number As String
Dim Found1 As Integer
Dim Found2 As Boolean
Dim Found3 As Boolean
Dim EOS As String
Dim EOSL As String
Dim EOL As String
Dim Replace As String
Dim n As Long
Dim m As Long
Dim b As Integer
Dim LastRow As Long
Dim CopyRange1 As String
Dim CopyRange2 As String
Dim numBlank As Integer
Dim c
With ActiveSheet
LastRow = .Range("A1").SpecialCells(xlCellTypeLastCell).Row
End With
For m = 1 To 10
Part_Number = ActiveCell(m, 1)
EOS = ActiveCell(m, 16)
EOSL = ActiveCell(m, 17)
EOL = ActiveCell(m, 18)
Replace = ActiveCell(m, 19)
Let CopyRange1 = "T" & m & ":" & "W" & m
For Each c In Range(CopyRange1)
If c.Value = "" Then
For n = m + 1 To 10
Found1 = InStr(ActiveCell(n, 1), Part_Number)
Found2 = IsEmpty(ActiveCell(n, 1).Value)
Let CopyRange2 = "T" & n & ":" & "W" & n
Found3 = IsEmpty(Range(CopyRange2).Value)
If Found2 = False And Found3 = False Then
If Found1 = 1 Then
ActiveCell(n, 16) = EOS
ActiveCell(n, 17) = EOSL
ActiveCell(n, 18) = EOL
ActiveCell(n, 19) = Replace
End If
End If
Next n
End If
Next c
Next m
End Sub
Aucun commentaire:
Enregistrer un commentaire