estatefinds
03-19-2016, 06:56 AM
The code I have works great! until I add data in column A that works with a different macro. so When I add this data and use the the code displayed here it grabs the data from column A which is incorrect the code only supposed to grab data from columns BCDEF. Sub M_snb() sn = Cells(9, 2).CurrentRegion
For j = 1 To UBound(sn)
For jj = 1 To UBound(sn, 2)
If InStr(c00, " " & sn(j, jj) & " ") <> 0 Then sn(j, jj) = "~"
c00 = c00 & " " & sn(j, jj) & " "
Next
Next
For j = 1 To UBound(sn)
sp = Filter(Application.Index(sn, j), "~", 0)
For jj = 1 To UBound(sn, 2)
sn(j, jj) = ""
If jj - 1 <= UBound(sp) Then sn(j, jj) = sp(jj - 1)
Next
If UBound(sp) > -1 Then c01 = c01 & " " & j
Next
sp = Application.Transpose(Split(Trim(c01)))
Cells(11, 38).Resize(UBound(sp), UBound(sn, 2)) = Application.Index(sn, sp, Array(1, 2, 3, 4, 5))
End Sub
For j = 1 To UBound(sn)
For jj = 1 To UBound(sn, 2)
If InStr(c00, " " & sn(j, jj) & " ") <> 0 Then sn(j, jj) = "~"
c00 = c00 & " " & sn(j, jj) & " "
Next
Next
For j = 1 To UBound(sn)
sp = Filter(Application.Index(sn, j), "~", 0)
For jj = 1 To UBound(sn, 2)
sn(j, jj) = ""
If jj - 1 <= UBound(sp) Then sn(j, jj) = sp(jj - 1)
Next
If UBound(sp) > -1 Then c01 = c01 & " " & j
Next
sp = Application.Transpose(Split(Trim(c01)))
Cells(11, 38).Resize(UBound(sp), UBound(sn, 2)) = Application.Index(sn, sp, Array(1, 2, 3, 4, 5))
End Sub