Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 15th, 2005, 08:08 AM
Registered User
 
Join Date: Nov 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default if the cell content is a part of another cell cont

Hi all

can any one let me know the vb code to check if the content of a cell is a part of the content of an other cell

for eg.

if cell (1,1)="LAN_ENV"
  cell (2,1)="LAN_TEST,LAN_ENV"

my vba code should check if "LON_ENV" exists in "LAN_TEST,LAN_ENV" I need the entire sting "LAN_ENV" to be compared with "LAN_TEST,LAN_ENV" and perform an action that is append to cell (2,1) the contents of cell(1,1) if the content of cell(1,1) does not exist in cell(2,1).

Thanks in advance.

 
Old November 15th, 2005, 10:20 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 180
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi

try something like this...

Range("A1").Select
On Error Resume Next
i = WorksheetFunction.Search(ActiveCell.Text, ActiveCell.Offset(1, 0).Text)
on error goto 0
If i = False Then ActiveCell.Offset(1, 0).Value = ActiveCell.Offset(1, 0).Value & ActiveCell.Value


cheers

Matt






Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I check if a cell content has changed SirAldemar Access VBA 2 August 13th, 2008 07:46 AM
right align one part of cell and center the rest crmpicco HTML Code Clinic 0 February 21st, 2006 09:09 AM
Dynamically Changing the content of a table cell asdasd Javascript 4 February 18th, 2005 01:44 PM
Capturing the content of a DataGrid Cell??? thomaz C# 1 November 12th, 2004 10:21 PM
Datagrid cell content value sinba Beginning VB 6 1 August 24th, 2004 01:58 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.