citizenzen
Programmer
Hi.
I am running a basic macro to search text within a long excel document. i am copying the contents of the search into a new excel document. the data is transposed. the problem is that some of the cells within the source document are blank.
ie:
so if the cell is empty, the contents of the next row are inserted into the blank cell! this is not what I need.
I need the data to look like the following:
User ID Email City Sector
User 1 78 xvy@yahoo.com Humble IT
User 13 45 Design
User 65 8 nyt@yahoo.com gary Network
and not:
User ID Email City Sector
User 1 78 xvy@yahoo.com Humble IT
User 13 45 nyt@yahoo.com gary User 65
User 65 8 nyt@yahoo.com gary Network
how can i accomplish this:
thanks in advance!
I am running a basic macro to search text within a long excel document. i am copying the contents of the search into a new excel document. the data is transposed. the problem is that some of the cells within the source document are blank.
ie:
Code:
User:
ID:
Email:
City:
Sector:
User:
ID:
Sector:
User:
ID:
Email:
Sector:
User:
ID:
Email:
City:
Sector:
so if the cell is empty, the contents of the next row are inserted into the blank cell! this is not what I need.
I need the data to look like the following:
User ID Email City Sector
User 1 78 xvy@yahoo.com Humble IT
User 13 45 Design
User 65 8 nyt@yahoo.com gary Network
and not:
User ID Email City Sector
User 1 78 xvy@yahoo.com Humble IT
User 13 45 nyt@yahoo.com gary User 65
User 65 8 nyt@yahoo.com gary Network
how can i accomplish this:
Code:
For i = 0 To UBound(sInt, 2) Step 1
lRow = 2
For Each rCells In ws_source.Cells.Range("A1986:A2008")
ws_dest.Range("A:G").EntireColumn.AutoFit
If InStr(rCells, sInt(0, i)) Then
'
ws_dest.Cells(lRow, 1 + i) = Mid(rCells.Value, sInt(1, i))
Set rCells = ws_source.Cells.Find(sInt(0, i))
lRow = lRow + 1
End If
Next
Next i
thanks in advance!