How to quote selected cell's value in MsgBox

jovie

Board Regular
Joined
Nov 13, 2015
Messages
68
Hi, I was trying to put selected cell's text in MsgBox
Like said , Range A contained all the item's name, and I want it to pop up a msgbox when Range E and Range F meet some requirement(This one I already write). But, I want the MsgBox show:" xxxxx(Range A's value) is low, Please refill ASAP!!"
However, I dun know how to quote RangeA's Value, Because I have quite a lot rows , I want it quote the row of RangeA's value.
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Hi,

Did you test the concatenation : Range("A2").Value & " is low, Please refill ASAP !! "

HTH
 
Upvote 0
Hi,

Did you test the concatenation : Range("A2").Value & " is low, Please refill ASAP !! "

HTH

I don't want this type, Here is my code.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim item As String
Dim diameter As Variant

n = Range("c65535").End(xlUp).Row
For i = 1 To n

If Range("C" & i) > 5 And Range("D" & i) < 10 Then
item = Range("F" & i).Value
diameter = Range("G" & i).Value
MsgBox "Storage of " & item & " , " & diameter & " is low, please proceed to purchase."
If Range("C" & i) < 5 And Range("C" & i) > 0 And Range("D" & i) < 5 Then
item = Range("F" & i).Value
diameter = Range("G" & i).Value
MsgBox "Storage of " & item & " , " & diameter & " is low, please proceed to purchase."
End If
End If
Next
End Sub
Please ignore those column it is testing in another workbook.
Because I have many rows like 150 rows, so I want MsgBox to pop up and show which row is low storage...
 
Upvote 0
Hi again,

The event macro you have selected ... worksheet_change without any restrictions for the Target area ...will be fired each and every time there is a change in the sheet ...

Is it your intent ...?
 
Upvote 0
Hi again,

The event macro you have selected ... worksheet_change without any restrictions for the Target area ...will be fired each and every time there is a change in the sheet ...

Is it your intent ...?

It is a problem also, because I want it show once and actually I want to set up a userform, however the file I intent to open is read-only file, so can't.
And I want it do now show up, till I open the workbook next time.
 
Upvote 0
Have you tried to use Private Sub Workbook_Open() in the module called ThisWorkbook ?
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,326
Members
452,635
Latest member
laura12345

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