imkumjamir
New Member
- Joined
- May 12, 2017
- Messages
- 1
I'm just a beginner in VBA. Below is a module for Pop up message box to display values of specified range with VBA code.
Now, please help me out in following points.
1. to display the Popup message of selected rows within the range of ("A5:I500,N5:AW500").
2. Is it possible to show "Row no. 5" as header in popup message.
3. And "Transpose" Pop up message.
Sub mesage()
Dim xRg As Range
Dim xTxt As String
Dim xCell As Range
Dim xStr As String
Dim xRow As Long
Dim xCol As Long
On Error Resume Next
If ActiveWindow.RangeSelection.Count > 1 Then
xTxt = ActiveWindow.RangeSelection.AddressLocal
Else
xTxt = ActiveSheet.UsedRange.AddressLocal
End If
Set xRg = Application.InputBox("Please select range:", "Pop up window", xTxt, , , , , 8)
If xRg Is Nothing Then Exit Sub
On Error Resume Next
For xRow = 1 To xRg.Rows.Count
For xCol = 1 To xRg.Columns.Count
xStr = xStr & xRg.Cells(xRow, xCol).Value & vbTab
Next
xStr = xStr & vbCrLf
Next
MsgBox xStr, vbInformation, "Pop up window"
End Sub
Now, please help me out in following points.
1. to display the Popup message of selected rows within the range of ("A5:I500,N5:AW500").
2. Is it possible to show "Row no. 5" as header in popup message.
3. And "Transpose" Pop up message.
Sub mesage()
Dim xRg As Range
Dim xTxt As String
Dim xCell As Range
Dim xStr As String
Dim xRow As Long
Dim xCol As Long
On Error Resume Next
If ActiveWindow.RangeSelection.Count > 1 Then
xTxt = ActiveWindow.RangeSelection.AddressLocal
Else
xTxt = ActiveSheet.UsedRange.AddressLocal
End If
Set xRg = Application.InputBox("Please select range:", "Pop up window", xTxt, , , , , 8)
If xRg Is Nothing Then Exit Sub
On Error Resume Next
For xRow = 1 To xRg.Rows.Count
For xCol = 1 To xRg.Columns.Count
xStr = xStr & xRg.Cells(xRow, xCol).Value & vbTab
Next
xStr = xStr & vbCrLf
Next
MsgBox xStr, vbInformation, "Pop up window"
End Sub