Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA Code - Find & Move Youlan Excel Discussion (Misc queries) 19 May 13th 08 11:42 PM
Find text and move Johnny Excel Discussion (Misc queries) 7 November 28th 07 04:08 PM
find text and move it saman110 via OfficeKB.com Excel Discussion (Misc queries) 2 September 26th 07 08:25 PM
Find and Move Data Stan Excel Discussion (Misc queries) 8 April 23rd 07 09:50 PM
Macro - Find a value and then move down Phil Osman Excel Discussion (Misc queries) 4 August 10th 05 01:20 PM


All times are GMT +1. The time now is 12:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"