MsgBox - takes text form a cell IF value of another cell is

clipro

Board Regular
Joined
Jan 12, 2005
Messages
195
Hi All,

I have got two sheets in a workbook and I am trying to create a macro that must:

On Sheet1 there is a button "submit Changes" that starts the Macro

1.In Sheet1 to check the value of cell A1 (the value depends of formula result)
2. If the value of cell A1 is 1 to go to (select) the Sheet2
3. If the value of Cell A1 is 2 to show a message box (OKonly) that must to take the text from cell A2
par example the text in A2 is "You have missed the first name of the customer"

I have one code that is too far away of this one that I need. Can you help me?
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Re: MsgBox - takes text form a cell IF value of another cell

How about:

Code:
Private Sub CommandButton1_Click()
Select Case Range("A1")
    Case 1
        Sheets(2).Select
    Case 2
        MsgBox Range("A2")
End Select
End Sub
 
Upvote 0
Re: MsgBox - takes text form a cell IF value of another cell

i would do the same as HOTPEPPER has suggested
 
Upvote 0
Re: MsgBox - takes text form a cell IF value of another cell

Thank you HotPepper,

It works more than perfect! :cool:

When I saw it I realised that it is not so difficult even for a greens in VBA like me :oops:

Best regards and thanks once again!!!
(y)
 
Upvote 0

Forum statistics

Threads
1,213,549
Messages
6,114,264
Members
448,558
Latest member
aivin

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