Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 82
Default VBA Question If column contains keyword

This is simple item for the gurus I am sure.

In my worksheet, in column C I want to identify a specific item from a list
of many others (by keyword) and then move the contents of another cell
(target).

Keyword in column C = "TVSS"

Target cell = one cell below and one cell to the right.
(Example: If TVSS is in cell C3, the target cell is D4)

Move target to = one cell up from orginal location.
(Example: If target cell was D4, move to D3)

Here is a befo
ColA ColB ColC ColD
1 1 Wall Mounted TVSS(AC11)
TME120Y100WM
2 1 Wall Mounted TVSS(AC11)
TME160Y100WM
3 1 Wall Mounted TVSS(AC11)
TME180Y100WM

Here is what I want after:
ColA ColB ColC ColD
1 1 Wall Mounted TVSS(AC11) TME120Y100WM
2 1 Wall Mounted TVSS(AC11) TME160Y100WM
3 1 Wall Mounted TVSS(AC11) TME180Y100WM


Thanks in advance!

Scott
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default VBA Question If column contains keyword


Set cell = Columns(1).Find(What:="TVSS",Lookat:=xlPart)
If Not cell Is Nothing Then
cell.Offset(0,1).Value = cell.Offset(1,1).Value
Row(cell.Offset(1,0).Row).Delete
End if

If you don't want the row delete, just remove that line.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Scott Wagner" wrote in message
...
This is simple item for the gurus I am sure.

In my worksheet, in column C I want to identify a specific item from a

list
of many others (by keyword) and then move the contents of another cell
(target).

Keyword in column C = "TVSS"

Target cell = one cell below and one cell to the right.
(Example: If TVSS is in cell C3, the target cell is D4)

Move target to = one cell up from orginal location.
(Example: If target cell was D4, move to D3)

Here is a befo
ColA ColB ColC ColD
1 1 Wall Mounted TVSS(AC11)
TME120Y100WM
2 1 Wall Mounted TVSS(AC11)
TME160Y100WM
3 1 Wall Mounted TVSS(AC11)
TME180Y100WM

Here is what I want after:
ColA ColB ColC ColD
1 1 Wall Mounted TVSS(AC11) TME120Y100WM
2 1 Wall Mounted TVSS(AC11) TME160Y100WM
3 1 Wall Mounted TVSS(AC11) TME180Y100WM


Thanks in advance!

Scott



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 82
Default VBA Question If column contains keyword

Bob,

Thanks for the quick response.

The code isn't working for me. I think it is because in my worksheet the
columns have some cells with blanks intermingled. The code you offered looks
like it stops if cell is nothing???

You know much more about this than I.

Thanks,

Scott

"Bob Phillips" wrote:


Set cell = Columns(1).Find(What:="TVSS",Lookat:=xlPart)
If Not cell Is Nothing Then
cell.Offset(0,1).Value = cell.Offset(1,1).Value
Row(cell.Offset(1,0).Row).Delete
End if

If you don't want the row delete, just remove that line.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Scott Wagner" wrote in message
...
This is simple item for the gurus I am sure.

In my worksheet, in column C I want to identify a specific item from a

list
of many others (by keyword) and then move the contents of another cell
(target).

Keyword in column C = "TVSS"

Target cell = one cell below and one cell to the right.
(Example: If TVSS is in cell C3, the target cell is D4)

Move target to = one cell up from orginal location.
(Example: If target cell was D4, move to D3)

Here is a befo
ColA ColB ColC ColD
1 1 Wall Mounted TVSS(AC11)
TME120Y100WM
2 1 Wall Mounted TVSS(AC11)
TME160Y100WM
3 1 Wall Mounted TVSS(AC11)
TME180Y100WM

Here is what I want after:
ColA ColB ColC ColD
1 1 Wall Mounted TVSS(AC11) TME120Y100WM
2 1 Wall Mounted TVSS(AC11) TME160Y100WM
3 1 Wall Mounted TVSS(AC11) TME180Y100WM


Thanks in advance!

Scott




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default VBA Question If column contains keyword

Scott,

Can you give a more accurate data example. Separate cells with a pipe
character, like so

123 | abc

so that we can see it better.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Scott Wagner" wrote in message
...
Bob,

Thanks for the quick response.

The code isn't working for me. I think it is because in my worksheet the
columns have some cells with blanks intermingled. The code you offered

looks
like it stops if cell is nothing???

You know much more about this than I.

Thanks,

Scott

"Bob Phillips" wrote:


Set cell = Columns(1).Find(What:="TVSS",Lookat:=xlPart)
If Not cell Is Nothing Then
cell.Offset(0,1).Value = cell.Offset(1,1).Value
Row(cell.Offset(1,0).Row).Delete
End if

If you don't want the row delete, just remove that line.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Scott Wagner" wrote in message
...
This is simple item for the gurus I am sure.

In my worksheet, in column C I want to identify a specific item from a

list
of many others (by keyword) and then move the contents of another cell
(target).

Keyword in column C = "TVSS"

Target cell = one cell below and one cell to the right.
(Example: If TVSS is in cell C3, the target cell is D4)

Move target to = one cell up from orginal location.
(Example: If target cell was D4, move to D3)

Here is a befo
ColA ColB ColC ColD
1 1 Wall Mounted TVSS(AC11)
TME120Y100WM
2 1 Wall Mounted TVSS(AC11)
TME160Y100WM
3 1 Wall Mounted TVSS(AC11)
TME180Y100WM

Here is what I want after:
ColA ColB ColC ColD
1 1 Wall Mounted TVSS(AC11) TME120Y100WM
2 1 Wall Mounted TVSS(AC11) TME160Y100WM
3 1 Wall Mounted TVSS(AC11) TME180Y100WM


Thanks in advance!

Scott






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 82
Default VBA Question If column contains keyword

Sorry about that sir. This should better illustrate.

Here is a befo
ColA | ColB | ColC | ColD
1 | 1 | Wall Mounted TVSS(AC11) |
| | | TME120Y100WM
2 | 1 | Wall Mounted TVSS(AC11) |
| | | TME160Y100WM
3 | 1 | Wall Mounted TVSS(AC11) |
| | | TME180Y100WM

Here is what I want after:
ColA | ColB | ColC | ColD
1 | 1 | Wall Mounted TVSS(AC11) | TME120Y100WM
2 | 1 | Wall Mounted TVSS(AC11) | TME160Y100WM
3 | 1 | Wall Mounted TVSS(AC11) | TME180Y100WM

"Bob Phillips" wrote:

Scott,

Can you give a more accurate data example. Separate cells with a pipe
character, like so

123 | abc

so that we can see it better.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Scott Wagner" wrote in message
...
Bob,

Thanks for the quick response.

The code isn't working for me. I think it is because in my worksheet the
columns have some cells with blanks intermingled. The code you offered

looks
like it stops if cell is nothing???

You know much more about this than I.

Thanks,

Scott

"Bob Phillips" wrote:


Set cell = Columns(1).Find(What:="TVSS",Lookat:=xlPart)
If Not cell Is Nothing Then
cell.Offset(0,1).Value = cell.Offset(1,1).Value
Row(cell.Offset(1,0).Row).Delete
End if

If you don't want the row delete, just remove that line.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Scott Wagner" wrote in message
...
This is simple item for the gurus I am sure.

In my worksheet, in column C I want to identify a specific item from a
list
of many others (by keyword) and then move the contents of another cell
(target).

Keyword in column C = "TVSS"

Target cell = one cell below and one cell to the right.
(Example: If TVSS is in cell C3, the target cell is D4)

Move target to = one cell up from orginal location.
(Example: If target cell was D4, move to D3)

Here is a befo
ColA ColB ColC ColD
1 1 Wall Mounted TVSS(AC11)
TME120Y100WM
2 1 Wall Mounted TVSS(AC11)
TME160Y100WM
3 1 Wall Mounted TVSS(AC11)
TME180Y100WM

Here is what I want after:
ColA ColB ColC ColD
1 1 Wall Mounted TVSS(AC11) TME120Y100WM
2 1 Wall Mounted TVSS(AC11) TME160Y100WM
3 1 Wall Mounted TVSS(AC11) TME180Y100WM


Thanks in advance!

Scott








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
Selecting a Keyword Gmata Excel Worksheet Functions 3 October 1st 09 10:06 PM
Sharing with Keyword Nam Excel Discussion (Misc queries) 0 April 28th 06 05:27 AM
search by keyword SubliminalJones Excel Discussion (Misc queries) 2 December 29th 05 04:29 PM
Formula to identify a keyword in all cells of a column HTC Excel Discussion (Misc queries) 3 July 28th 05 03:57 PM
SQL Keyword S Taylor[_2_] Excel Programming 2 October 6th 04 03:10 PM


All times are GMT +1. The time now is 04:20 PM.

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

About Us

"It's about Microsoft Excel"