Hi all,
So I'm trying to set up a reminder that checks if the week number is the same as current week number, if so then display a msgbox containing the information but unsure of the method to store the information into a variable.
My code that I've started below is just a small scale but is along the lines of what I want however it doesn't contain multiple strings, just the last one in the loop.
Excel and what I want to display in the end..
<tbody>
</tbody>
Msgbox
Just a gentle reminder, the following are this week:
- Name1: ID0001 ID-Name1
- Name2: ID0002 ID-Name2
So I'm trying to set up a reminder that checks if the week number is the same as current week number, if so then display a msgbox containing the information but unsure of the method to store the information into a variable.
My code that I've started below is just a small scale but is along the lines of what I want however it doesn't contain multiple strings, just the last one in the loop.
Code:
Sub Reminder()
Dim wsSheet1 As Worksheet
Dim LR As Long, I As Long, X As Long
' Should I be using Arrays for this?
Dim AName() As Variant
Dim SNo() As Variant
Dim SName() As Variant
Dim MsgBody As String
Set wsSheet1 = Sheets(1)
LR = wsSheet1.Cells(Rows.Count, "A").End(xlUp).Row
For I = 2 To LR
With wsSheet1
If .Cells(I, 1) = Evaluate("=weeknum(today()-238)") Then
AName = .Cells(I, 2)
SNo = .Cells(I, 3)
SName = .Cells(I, 4)
Else
End If
End With
Next I
'How to use Arrays to contain multiple strings?
MsgBody = vbNewLine & vbNewLine & " - " & AName(X) & ": " & SNo(X) & " " & SName(X)
MsgBox "The following visit packs are needed this week:" & MsgBody
End Sub
Excel and what I want to display in the end..
A | B | C | D | |
1 | WeekNo | Name | ID Number | ID Name |
2 | 12 | Name1 | ID0001 | ID-Name1 |
3 | 12 | Name2 | ID0002 | ID-Name2 |
4 | 13 | Name3 | ID0003 | ID-Name3 |
<tbody>
</tbody>
Msgbox
Just a gentle reminder, the following are this week:
- Name1: ID0001 ID-Name1
- Name2: ID0002 ID-Name2
Last edited: