PDA

View Full Version : Need VBA code revised to ignore the Column A data, please!



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

PAB
03-19-2016, 08:12 AM
Hi Dennis,

You have two Subs, one in Sheet 3 (raw data) named Sub M_snb(), and one in Module 1 named Sub N_snb().
Looking at it, you need to run the Sub in Module 1.
The Sub M_snb() picks up column A, whereas the Sub N_snb() picks up column B.
I can't see why you have got the other Sub in Sheet 3 (raw data) named Sub M_snb(), I think you need to delete that one.

I hope this helps.

estatefinds
03-19-2016, 08:28 AM
let me check Thank you

estatefinds
03-19-2016, 09:55 AM
ok so i did what you said, and it keeps doing it. here is what happened on the attachment.
Thank you!