Hello I have managed to extract out the wanted info from other sheets. It looks something like this. enter image description here but now I have no idea on how to display those info. I would like to display only A and J column. something like this. enter image description here
And another problem I face is that the number documents will change. For example, in this case there are three documents to display but there could be in stance, where only one or three or even no document to display. I have came out with a code to tackle this problem and display "No document is due" if no document is on the list.
Could someone please help me with this. I am not asking for the full answer, I need some guidance on how to save the wanted info (A and J column) (for various number of documents). Thank youu
You can loop through each row containing data, and append the relevant values to an output message. The when the loop is complete, display that message.
Something like this:
Sub foo()
Dim lRow As Long
Dim lRowMax As Long
Dim strMsg As String
Dim strPlural As String
With Sheet1
lRowMax = .Cells(Rows.Count, 1).End(xlUp).Row
If lRowMax = 1 Then
strMsg = "No document is due"
Else
If lRowMax = 2 Then
strMsg = "This document requires a revision"
Else
strMsg = "These documents require a revision"
End If
strMsg = strMsg & vbCr
For lRow = 2 To lRowMax
strMsg = strMsg & vbCr & .Cells(lRow, 1).Value & vbTab & .Cells(lRow, 10).Value
Next lRow
End If
End With
MsgBox strMsg, vbOKOnly, "Reminder"
End Sub
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.