ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Making a msgbox return a value in one cell, when data is searched and found in another. TIA (https://www.excelbanter.com/excel-programming/430699-making-msgbox-return-value-one-cell-when-data-searched-found-another-tia.html)

JasonK[_3_]

Making a msgbox return a value in one cell, when data is searched and found in another. TIA
 

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


Gary Keramidas

Making a msgbox return a value in one cell, when data is searched and found in another. TIA
 
if the data you want is in row 1, try adding this to the message box

msgbox "test " & cells(1,c.column).value

--

Gary Keramidas
Excel 2003


"JasonK" wrote in message
...

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

Making a msgbox return a value in one cell, when data is searched and found in another. TIA
 

I answered this in .misc. Please do NOT waste responders time by posting in
more than ONE group.
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"JasonK" wrote in message
...

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



JasonK[_3_]

Making a msgbox return a value in one cell, when data is searched and found in another. TIA
 

Don G,

Usually I ask my questions in .misc. When I did so this time, and
checked to see if the question posted, I saw dozens of ads for items
for sale. I thought perhaps the group had been abandoned or corrupted
and sought another group to post my query to.

Sorry for the trouble and thank you for the answer.

JasonK




On Sat, 4 Jul 2009 07:42:36 -0500, "Don Guillett"
wrote:


I answered this in .misc. Please do NOT waste responders time by posting in
more than ONE group.



Don Guillett

Making a msgbox return a value in one cell, when data is searched and found in another. TIA
 

Setting up Outlook Express/Windows Mail to access Microsoft newsgroups
http://www.michaelstevenstech.com/ou...snewreader.htm

Accessing the MS newsgroups in Outlook Express/Windows Mail Newsreader
http://www.microsoft.com/windowsxp/e...roupsetup.mspx
Automate logon to web site
http://www.codeforexcelandoutlook.co...tExplorer.html


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"JasonK" wrote in message
...

Don G,

Usually I ask my questions in .misc. When I did so this time, and
checked to see if the question posted, I saw dozens of ads for items
for sale. I thought perhaps the group had been abandoned or corrupted
and sought another group to post my query to.

Sorry for the trouble and thank you for the answer.

JasonK




On Sat, 4 Jul 2009 07:42:36 -0500, "Don Guillett"
wrote:


I answered this in .misc. Please do NOT waste responders time by posting
in
more than ONE group.





All times are GMT +1. The time now is 02:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com