Message box List

Godwin117

Board Regular
Joined
Dec 19, 2019
Messages
68
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I have been searching with no avail on a vba to display a msgbox with specific data. I have an idea but the specific throw me off (still a beginner). This message box will display a value1 then tab then value2 then tab value3 then new line value1-2, tab value 2-2, tab value 3-2 and so on until the last row. Value 1 data range is sheet 3 column B, value 2 is sheet 3 column D, value 3 is sheet 3 column E. Any help would be greatly appreciated.
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Hello Godwin117,
try this...
VBA Code:
Sub MsgBoxTabNewLine()

       Dim vN As Long
       Dim vNR As Long
       Dim vMsg As String
     
       With Sheets("Sheet3")
           vN = .Cells(Rows.Count, "B").End(xlUp).Row
           For vNR = 1 To vN
              vMsg = vMsg & .Range("B" & vNR) & vbTab & _
                            .Range("D" & vNR) & vbTab & _
                            .Range("E" & vNR) & vbCrLf
           Next vNR
       End With
       MsgBox (vMsg)

End Sub
 
Last edited:
Upvote 0
Hello Godwin117,
try this...
VBA Code:
Sub MsgBoxTabNewLine()

       Dim vN As Long
       Dim vNR As Long
       Dim vMsg As String
    
       With Sheets("Sheet3")
           vN = .Cells(Rows.Count, "B").End(xlUp).Row
           For vNR = 1 To vN
              vMsg = vMsg & .Range("B" & vNR) & vbTab & _
                            .Range("D" & vNR) & vbTab & _
                            .Range("E" & vNR) & vbCrLf
           Next vNR
       End With
       MsgBox (vMsg)

End Sub
Thank you, that worked perfectly.
 
Upvote 0

Forum statistics

Threads
1,223,948
Messages
6,175,570
Members
452,652
Latest member
eduedu

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