I have a csv file (which is an export from a printer), which is not nicely readable and it also has a lot of information which is not needed. So I had written a VBA macro to copy the relevant data to a second sheet.
With the vba code, I'm looking in worksheet 1 for specific text phrases which will be copied to worksheet 2. These text phrases are not in a specific column in worksheet 1, so I have to look through the complete sheet 1. My code is working, but I have one problem which is to tricky for me and that's why I need your help.
In my case, I'm looking for the phrase "Druckbeginn =" (this is German and means Printstart) and is followed by a unix timecode. In most rows, the phrase "Druckbeginn =" exists, but in some it does not.
So lets say in row 1, 2 and 4 the phrase is existing but in row 3 not. The problem is, that my vba code copies the cells from worksheet one to worksheet two, but it copies into the row 1 ,2 and 3 and not to 1, 2 and 4.
If you need my csv file and/or my complete vba code, please let me know.
this is my code:
w1.Activate
For Each r In Intersect(Range("A:AS"), ActiveSheet.UsedRange)
v = r.Value
If InStr(v, "Druckbeginn =") > 0 Then
r.Copy w2.Cells(B, 3)
B = B + 1
End If
Next r