Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / July 2009

Tip: Looking for answers? Try searching our database.

Making a MsgBox return cell data when search finds different data in an adjacent cell

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JasonK - 04 Jul 2009 06:27 GMT
Thank you for helping me with this in advance. I'm grateful for all
the help I've found in these groups.

I'm running a macro that is searching a sheet for data.  When it finds
that data, I need a msgbox to pop up with the data from that column's
top cell.

I have it searching the sheet and finding the data listed in the
search.

Because of the possibility of multiple winners, the msgbox will pop up
each time someone scores.

This macro works fine as it is except I would like to add the winners
names to the message boxes.

thanks again,
JasonK

With Worksheets(1).Range("A4:AF54")
   Dim mySearch As String
   Dim winner As String
   Dim myReplaceValue
   mySearch = InputBox("Name? ")
   myReplaceValue = InputBox("Score value? ")
   Set c = .Find(mySearch, LookIn:=xlValues)
   If Not c Is Nothing Then
       firstAddress = c.Address
       Do
           c.Offset(, 1) = myReplaceValue
           c.Offset.Interior.ColorIndex = 1
           c.Offset(, 1).Interior.ColorIndex = 1
           c.Offset(, -1).Interior.ColorIndex = 1
           c.Offset(, -1) = "X"
           c.Offset(, -1).Font.Bold = True
           c.Offset.Font.ColorIndex = 2
           c.Offset(, 1).Font.ColorIndex = 2
           c.Offset(, -1).Font.ColorIndex = 2
           
           msgbox TOP VALUE IN COLUMN " scored."
           
           
           
           Set c = .FindNext(c)
           Count = Count + 1
       Loop While Not c Is Nothing And c.Address <> firstAddress
   End If
End With
Don Guillett - 04 Jul 2009 13:37 GMT
MsgBox Cells(1, c.Column)

Signature

Don Guillett
Microsoft MVP Excel
SalesAid Software
dguillett1@austin.rr.com

>
> Thank you for helping me with this in advance. I'm grateful for all
[quoted text clipped - 43 lines]
>    End If
> End With
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.