Dynamic dialogBox update

blaksnm

Well-known Member
Joined
Dec 15, 2009
Messages
554
Office Version
  1. 365
Platform
  1. Windows
Hi
I have some instructions as text in Range("Instructions1") and Range("Instructions2")
I want this to appear as one interactive messagebox when starting the excel-file (auto_open) so I can give new input in the msgbox who updates the ranges when macro proceeds (by "ok" or something like that)
How do I do this?
Will anyone guide me on this?
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Hi,

Please check if below fulfil the requirement.

Below code will be on Workbook event and will activate when you open the workbook.

VBA Code:
Private Sub Workbook_Open()
    Dim response As String
    response = MsgBox("Want to change instructions?" & Sheets("Sheet2").Range("instructions1"), vbYesNo + vbQuestion, "Instructions")
    
    If response = vbYes Then
        newmsg = InputBox("Enter new message for instruction 1")
        Sheets("Sheet2").Range("instructions1") = newmsg
        
    End If
End Sub
 
Upvote 0
Sorry to say
It did not work
Run time error 13 in line "*"

Private Sub Workbook_Open()
Dim response As String
"*" response = MsgBox("Want to change instructions?" & Sheets("Reg").Range("OppgaverFaste"), vbYesNo + vbQuestion, "Instructions")

If response = vbYes Then
newmsg = InputBox("Enter new message for instruction 1")
Sheets("Sheet2").Range("instructions1") = newmsg

End If
End Sub
 
Upvote 0
try changing
VBA Code:
Dim Response as string

to

VBA Code:
Dim response
 
Upvote 0
Hm..I still dont understand the error
Sub Test()
Dim response
response = MsgBox("Want to change instructions?" & Sheets("Reg").Range("OppgaverFaste"), vbYesNo + vbQuestion, "Oppgaverfaste")

If response = vbYes Then
newmsg = InputBox("Enter new message for instruction 1")
Sheets("Reg").Range("OppgaverFaste") = newmsg

End If
End Sub
 
Upvote 0
Hm..I still dont understand the error
Sub Test()
Dim response
response = MsgBox("Want to change instructions?" & Sheets("Reg").Range("OppgaverFaste"), vbYesNo + vbQuestion, "Oppgaverfaste")

If response = vbYes Then
newmsg = InputBox("Enter new message for instruction 1")
Sheets("Reg").Range("OppgaverFaste") = newmsg

End If
End Sub
Is the problem resolved?

Because I am not getting any error in both cases.

The Run-time Error 13 occurs when we try to run VBA code that includes data types that are not matched correctly.
Runtime error 13 is type mismatch error.
 
Upvote 0
Is the problem resolved?

Because I am not getting any error in both cases.

The Run-time Error 13 occurs when we try to run VBA code that includes data types that are not matched correctly.
Runtime error 13 is type mismatch error.
No - sorry
Problem not solved
Macro bug at:
response = MsgBox("Want to change instructions?" & Sheets("Reg").Range("OppgaverFaste"), vbYesNo + vbQuestion, "OppgaverVariable")
 
Upvote 0
Is the named range OppgaverFaste a single cell?
 
Upvote 0

Forum statistics

Threads
1,215,054
Messages
6,122,895
Members
449,097
Latest member
dbomb1414

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