Using Message boxes to display cell content

CalumJames

New Member
Joined
Jun 18, 2011
Messages
13
Hi all.

Am i correct in thinking I'm missing something here? I'm trying to find a guide that will text me how to create VBA for a message box which displays the content of an active cell (if clicked once) in Column J of my sheet... however as much as I've searched multiple sites there is very little on this that can assist me but instead talks of comment boxes which I don't want because the message box needs to lead onto two user forms via buttons.

Can anyone confirm if this is possible? I can't see why it isn't? And does anyone possibly have some sample code?

Greatly appreciate any assistance because I'm not getting very far ;)

Thanks
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Try this: right click the sheet tab, select View Code and paste in

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 10 Then MsgBox Target.Value, vbInformation, Target.Address(False, False)
End Sub
 
Upvote 0
Thanks - a little further forward. I now need to amend this "box" to add two further buttons.... how do I do this as I don't know where it's pulling these alerts from?
 
Upvote 0
Thanks - a little further forward. I now need to amend this "box" to add two further buttons....

Two buttons to do what?

how do I do this as I don't know where it's pulling these alerts from?

What does that mean? Did you look at the title of the message box - it has the cell address.
 
Upvote 0
Apologies I wasn't very clear. The two Buttons are:

1. to Cancel / close the messagebox
2. The second needs to close the message box & open a userform called: transitonupdates

Ignore the titles I since sorted that.

Thanks again!! :)
 
Upvote 0
Does anyone know how to amend these messagebox buttons? I need to work out how to point it to the userform if they select ok

Code below:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 10 Then MsgBox Target.Value, vbInformation, Target.Address(False, False)
End Sub

And I need to merge this with


Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 11 Then
If Target = "completed" Then
Application.EnableEvents = False
nxtRow = Sheets("Completed Major Tab").Range("I" & Rows.Count).End(xlUp).Row + 1
Target.EntireRow.Copy _
Destination:=Sheets("Completed Major Tab").Range("A" & nxtRow)
Target.EntireRow.Delete
End If
If Target = "On Hold" Then
Application.EnableEvents = False
nxtRow = Sheets("IA Register").Range("I" & Rows.Count).End(xlUp).Row + 1
Target.EntireRow.Copy _
Destination:=Sheets("IA Register").Range("A" & nxtRow)
Target.EntireRow.Delete
End If
Application.EnableEvents = True
End If
End Sub
 
Upvote 0
Try something like this

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 10 Then
    If MsgBox(Target.Value & vbNewLine & "show form", vbInformation + vbOKCancel, Target.Address(False, False)) = vbOK Then TransitionUpdates.Show
End If
End Sub
 
Upvote 0
Thanks... that doe help though the button is labelled ok - i can't see a way of changing this easily without having to make a custom message box, but then from my knowledge of VBA I'd loose the expanding menu to fit the content?

Is there an easy way to label the buttons?
 
Upvote 0

Forum statistics

Threads
1,224,587
Messages
6,179,740
Members
452,940
Latest member
Lawrenceiow

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top