Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 15th, 2005, 08:08 AM
Registered User
Join Date: Nov 2005
Location: , , .
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.

Reply With Quote
  #2 (permalink)  
Old November 15th, 2005, 10:20 AM
Friend of Wrox
Join Date: Jan 2005
Location: Bournemouth, Dorset, United Kingdom.
Posts: 180
Thanks: 0
Thanked 0 Times in 0 Posts


try something like this...

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



Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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

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

All times are GMT -4. The time now is 06:12 AM.

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