WUGNET, the Windows User Group Network
Your Complete Resource Center for "The Best" in Shareware, Computing Tips and Support, Windows Industry News... and much more!
Home Forums Shareware Windows Tips Hot Offers FREE Newsletters Arcade Contact Us About Partners
Search WUGNET: RSS Feeds RSS Feeds Advertise with WUGNET    |    Shareware eBooks
HomeHome FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

IF cells(row,column) contain "this word" ??? Then return t..

 
   Home -> Office -> New Users RSS
Next:  how to display two spread sheets side by side  
Author Message
meiftan

External


Since: Jan 03, 2008
Posts: 1



(Msg. 1) Posted: Thu Jan 10, 2008 6:04 pm
Post subject: IF cells(row,column) contain "this word" ??? Then return text
Archived from groups: microsoft>public>excel>newusers (more info?)

Hi,
I'm a new user working on a database using excel, and I want to make a
search feature.
example, some cells contain "Mark Sungkar" , "Mark Hopeless" , "Mark And
Friends"

this code doesn't work :
x = Sheets("database").Cells(Rows.Count, "B").End(xlUp).Row

For z = 2 To x
If Sheets("database").Cells(z, 2) = "Mark" Then
'return the cell contains "Mark" with his full name
end if
Next z

the "x" counts cells contain data
Thank You for any help
Regards,
Back to top
Login to vote
Bernie Deitrick

External


Since: Apr 02, 2004
Posts: 1177



(Msg. 2) Posted: Thu Jan 10, 2008 10:01 pm
Post subject: Re: IF cells(row,column) contain "this word" ??? Then return text [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Dim myR As Range
Dim myC As Range
With Sheets("database")
.Cells(2, 2).CurrentRegion.AutoFilter Field:=2, Criteria1:="=*mark*"
Set myR = Intersect(.UsedRange, .Range("B2:B" & Rows.Count)) _
.SpecialCells(xlCellTypeVisible)
MsgBox "These cells: " & myR.Address & Chr(10) & "All contain the word
""Mark"""
For Each myC In myR
MsgBox myC.Address & " contains """ & myC.Text & """"
Next myC
End With

You don't say what you want to do with the Text, so I just show the values
in msgboxes.

HTH,
Bernie
MS Excel MVP


"meiftan" <meiftan.TakeThisOut@discussions.microsoft.com> wrote in message
news:DC22357D-9603-4EBB-857D-F8D8DFBD8C6D@microsoft.com...
> Hi,
> I'm a new user working on a database using excel, and I want to make a
> search feature.
> example, some cells contain "Mark Sungkar" , "Mark Hopeless" , "Mark And
> Friends"
>
> this code doesn't work :
> x = Sheets("database").Cells(Rows.Count, "B").End(xlUp).Row
>
> For z = 2 To x
> If Sheets("database").Cells(z, 2) = "Mark" Then
> 'return the cell contains "Mark" with his full name
> end if
> Next z
>
> the "x" counts cells contain data
> Thank You for any help
> Regards,
Back to top
Login to vote
Display posts from previous:   
       Home -> Office -> New Users All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Categories:
 Windows XP
 Windows Vista
 Windows Other
  Office
 Office Other
 Security
 WinRAR
  • Home |
  • Shareware |
  • Windows Tips |
  • Hot Offers |
  • FREE Newsletters |
  • Arcade |
  • Forums |
  • eBooks |
  • About WUGNET |
  • Partners |
  • Contact

  • WUGNET Privacy Policy |
  • Link to WUGNET