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

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

Scott Huish

MrExcel MVP
Joined
Mar 17, 2004
Messages
19,958
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
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
 

Te4t0n

New Member
Joined
Jan 23, 2005
Messages
21
Re: MsgBox - takes text form a cell IF value of another cell

i would do the same as HOTPEPPER has suggested
 

clipro

Board Regular
Joined
Jan 12, 2005
Messages
195
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)
 

Forum statistics

Threads
1,147,619
Messages
5,742,175
Members
423,708
Latest member
vagosh2001

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
Top