PDA

View Full Version : Solved: Find the words "*-*Shares" from ColF and move to ColG



buhay
12-02-2010, 12:19 PM
I am looking for a macro that finds the following words:

D1 - SHARES, F-SHARES etc. (the letters in front of - shares and -shares change all the time)
located on ColF and ColH and move them to ColG without changing the row number.

For example:

------------ColF------------ColG------------ColH------------

row1--D1 - SHARES

row2--F-SHARES

row3--D1 - SHARES

row4-------------------------------------Z-SHARES

row5-----------------------A-Shares

row6-----------------------B-Shares

row7-----------------------C-Shares

row8-------------------------------------X - SHARES


Result after using the macro:

------------ColF------------ColG------------ColH------------

row1-----------------------D1 - SHARES

row2-----------------------F-SHARES

row3-----------------------D1 - SHARES

row4-----------------------Z-SHARES

row5-----------------------A-Shares

row6-----------------------B-Shares

row7-----------------------C-Shares

row8-----------------------X - SHARES

Thanks in advance

p45cal
12-02-2010, 02:56 PM
experiment with:Sub blah()
With ActiveSheet
For Each cll In Intersect(.UsedRange, .Range("F:F,H:H")).Cells
If InStr(1, cll.Value, "shares", vbTextCompare) > 0 Then cll.Cut .Cells(cll.Row, "G")
Next cll
End With
End Sub

Sean.DiSanti
12-02-2010, 04:08 PM
experiment with:Sub blah()

lol, that's my default sub name too

buhay
12-04-2010, 09:27 AM
i love this forum. thank you very much