Contain a value from a cell within a MsgBox

gheyman

Well-known Member
Joined
Nov 14, 2005
Messages
2,347
Office Version
  1. 365
Platform
  1. Windows
I want to add the value (Number) from a cell within my message. How do you this? Thanks for the help

Code:
Sub RunValidation()

    Sheets("Step 2").Visible = True
    Sheets("Step 2").Activate
    
    TransferPartNumbers

        Range("Q16").Select
        Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False
            
            
        Range("G16").Select
        Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False
        
        
'*********************************
'Enter Formulas
'********************************

    Range("C13").Select
        ActiveCell.FormulaR1C1 = _
            "=CONCATENATE(""Count: "", SUBTOTAL(103,Table10[Enter Your Part Numbers]))"
    Range("G13").Select
        ActiveCell.FormulaR1C1 = _
            "=CONCATENATE(""Count: "", SUBTOTAL(103,SelectedPartsValidation[ItemID]))"
    Range("Q13").Select
        ActiveCell.FormulaR1C1 = _
            "=CONCATENATE(""Count: "", SUBTOTAL(103,MismatchedPartsList[Mismatched]))"
    Range("H13").Select
        ActiveCell.FormulaR1C1 = _
            "=IF(SUBTOTAL(103,Table10[Enter Your Part Numbers])>SUBTOTAL(103,SelectedPartsValidation[ItemID]),""You have either entered P/N's incorrectly, entered duplicates or entered P/N's not in CostPoint, please check"","""")"
        
        
'***********************************
'Paste Values for Formulas
'***********************************

    Calculate
    
    Range("C13").Select
        Selection.Copy
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
    Range("G13:H13").Select
        Application.CutCopyMode = False
        Selection.Copy
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
    Range("Q13").Select
        Application.CutCopyMode = False
        Selection.Copy
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        Application.CutCopyMode = False
        
'**************************
'Reformat Table Areas
'**************************
        
     Sheets("Other Tables").Calculate
        
    If Sheets("Other Tables").Range("I3").Value > 0 Then
    MsgBox "You have X Part(s) in your list that are mismatched. These Parts are not in CostPoint or you entered Duplicates"
    
    Else
    End If
 
End Sub
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Maybe:
VBA Code:
X = Sheets("Other Tables").Range("I3").Value
If X > 0 Then
    MsgBox "You have " & X & " Part(s) in your list that are mismatched. These Parts are not in CostPoint or you entered Duplicates"
End If
 
Upvote 0
Solution

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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