How to get text and a variable in a messagebox

前端 未结 5 1136
滥情空心
滥情空心 2021-02-07 15:11

I just need to know how to have plain text and a variable in a messagebox.

For example:

I can do this: MsgBox(variable)

And I can do this: <

5条回答
  •  深忆病人
    2021-02-07 15:49

    I wanto to display the count of rows in the excel sheet after the filter option has been applied.

    So I declared the count of last rows as a variable that can be added to the Msgbox

    Sub lastrowcall()
    Dim hm As Worksheet
    Dim dm As Worksheet
    Set dm = ActiveWorkbook.Sheets("datecopy")
    Set hm = ActiveWorkbook.Sheets("Home")
    Dim lngStart As String, lngEnd As String
    lngStart = hm.Range("E23").Value
    lngEnd = hm.Range("E25").Value
    Dim last_row As String
    last_row = dm.Cells(Rows.Count, 1).End(xlUp).Row
    
    MsgBox ("Number of test results between the selected dates " + lngStart + " 
    and " + lngEnd + " are " + last_row + ". Please Select Yes to continue 
    Analysis")
    
    
    End Sub
    

提交回复
热议问题