Infoconstructionrecruit
New Member
- Joined
- May 16, 2022
- Messages
- 11
- Office Version
- 365
- Platform
- Windows
HI All
I would be grateful for the advice on the following:
I have two "For Next" Statements nested inside each other.
The outer loop takes a phone number from a spreadsheet, then looks the number up on a messaging service.
The inner loop identifies the message conversations and drops each message back into the another sheet. The messages returned need to be on the same row as the number, but each individual message needs to be in its own column.
I have no problems with the columns part of this code.
Its is the rows. I cannot get the code to move down to the next row, when the search for the next number starts.
Any advice on the above would be appreciated.
Sample of the code in question:
I would be grateful for the advice on the following:
I have two "For Next" Statements nested inside each other.
The outer loop takes a phone number from a spreadsheet, then looks the number up on a messaging service.
The inner loop identifies the message conversations and drops each message back into the another sheet. The messages returned need to be on the same row as the number, but each individual message needs to be in its own column.
I have no problems with the columns part of this code.
Its is the rows. I cannot get the code to move down to the next row, when the search for the next number starts.
Any advice on the above would be appreciated.
Sample of the code in question:
VBA Code:
For Each ContactNumbers In MessagesSheet.Range("A2:A4")
SearchNumber.SendKeys ContactNumbers.Value & (ks.Enter)
ch.Wait 3000
'Returns all messages once (includes message and time of message)
Set ResultMessages = ch.FindElementsByClass("_22Msk")
For Each ResultMessage In ResultMessages
ColNum = ColNum - 1
Set TargetCell = MessagesReturnedSheet.Cells(2, ResultMessages.Count + 6 + ColNum)
TargetCell.Value = ResultMessage.Text
Next ResultMessage
Next ContactNumbers
Last edited by a moderator: