Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Find THIS and move it HERE
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 -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Find THIS and move it HERE
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 -- Regards Frank Kabel Frankfurt, Germany Im having some problems with a macro im trying to build and i was hoping one of you would have an answer for me. I have a series of databases in Excel that contain a different amount of records of varying length. I would like to know the best way to scan all the data for a cell that contains one of about 20 different processing codes, cut the value and paste it to column AJ in the same 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. --- Message posted from http://www.ExcelForum.com/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Find THIS and move it HERE
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 -- Message posted from http://www.ExcelForum.com |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Find THIS and move it HERE
Hi
try If InStr(cell.value,code) then... -- Regards Frank Kabel Frankfurt, Germany Hi, thank you ! I also needed this one. But can you pls explain further - 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. --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
VBA Code - Find & Move | Excel Discussion (Misc queries) | |||
Find text and move | Excel Discussion (Misc queries) | |||
find text and move it | Excel Discussion (Misc queries) | |||
Find and Move Data | Excel Discussion (Misc queries) | |||
Macro - Find a value and then move down | Excel Discussion (Misc queries) |