Msgbox question

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,738
Office Version
  1. 2007
Platform
  1. Windows
Hi,

The code in use is shown below.

Please can you explain why or what this part refers or does warning = MsgBox(Range("A6").Value

I press the button,i am asked the question,the range in question that will be changed to 0 is C1:F17 so im lost as to why A6 is even there.....


Code:
Sub zero()'
' zero Macro
'


'
    Dim warning
    warning = MsgBox(Range("A6").Value & "Are You Sure You Wish To Zero All The Cells ?", vbQuestion + vbYesNo, "Warning This Will Delete The Cell Info")
    If warning = vbNo Then Exit Sub
    
    
    Range("D1", "D17") = "0"
    Range("F1", "F17") = "0"
    Range("C1:F17").Select
        With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .ThemeColor = xlThemeColorAccent5
        .TintAndShade = 0.599993896298105
        .PatternTintAndShade = 0
        End With
    Range("A13").Select
End Sub
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Whatever is in range A6 is used for the start of the warning message, that's all.
 
Upvote 0
Very strange because the message is roughly C10:D14 nowhere near A6 ???
 
Upvote 0
You're missing the point, I think.The content of A6 will be the first part of the message text that appears on the message box. It has nothing to do with where the message appears or what the rest of the code does. (at a guess, I would say that A6 is intended to contain a user name or something)
 
Upvote 0
You're missing the point, I think.The content of A6 will be the first part of the message text that appears on the message box. It has nothing to do with where the message appears or what the rest of the code does. (at a guess, I would say that A6 is intended to contain a user name or something)

Changing A6 to anything then running the code i dont see or notice anything at all.
I have even selected cells that are empty.

It was a question but as nothing happens i should then just leave/forget about it.
 
Upvote 0
I dont think you are looking at the textbox if you think nothing is changing. Within the white main body of the textbox is a question. It WILL change if you change the contents of the cell A6 provided the cell A6 is on the activesheet when that line is executed. Anyway if you are happy you are happy.
 
Upvote 0
I dont think you are looking at the textbox if you think nothing is changing. Within the white main body of the textbox is a question. It WILL change if you change the contents of the cell A6 provided the cell A6 is on the activesheet when that line is executed. Anyway if you are happy you are happy.

I understand what you are saying but A6 has nothing to do with this button.
Upon the button press cells C1:F17 values are just reset to 0

Cheers
 
Upvote 0
If A6 contained the word Fred, then the message on the message box would be:

FredAre You Sure You Wish To Zero All The Cells ?
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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