Find THIS and move it HERE

  • Thread starter Thread starter Green
  • Start date Start date
G

Green

Im having some problems with a macro im trying to build and i was hopin
one of you would have an answer for me.
I have a series of databases in Excel that contain a different amoun
of records of varying length. I would like to know the best way t
scan all the data for a cell that contains one of about 20 differen
processing codes, cut the value and paste it to column AJ in the sam
row the data was found.

So its....

Do
IF (current field) contains (one of my codes)
THEN move (data in current field) to column AJ
WHILE (database has more data)

I appreciate any help anyone can give
 
Hi
try the following (processes the current selection)

Sub foo()
Dim rng As Range
Dim rng As Range
Dim cell As Range

Set rng = Selection
For Each cell In rng
Select Case cell.Value
Case "code1", "code2", "code3"
Cells(cell.row, "AJ").Value = cell.Value
Case Else
'do nothing
End Select
Next
End Sub
 
Hi, thank you ! I also needed this one. But can you pls explain furthe
- what if I want:

IF (code) is (part of cell content)
THEN (move to column AJ)

The macro you pasted above works only if it is a full match. Thank you
 
Back
Top