Carl Clements
Board Regular
- Joined
- Jun 13, 2008
- Messages
- 95
I have the below code that works along a spreadsheet (inserting 1 row per day) and then processes a transaction at the end (with the Call IA_Adjustment sub).
After a weekend, it currently inserts 3 rows and Calls 'IA_Adjustment' after each row. However, I want it to only Call 'IA_Adjustment' after the third row is inserted.
The variable that stores the number of rows is 'I'
I think I need another Do Until Loop but I'm not sure where it would go. Can anybody advise?
[D8].Select
Do Until Trim(ActiveCell.Value) = ""
Cusip = Trim(ActiveCell.Value)
If Len(Cusip) <> 9 Then
MsgBox "Please check the cusip is correct in cell " & ActiveCell.Address, vbInformation, "Cusip Incorrect"
End
Else
End If
ActiveCell.Offset(1, 3).Select
Do Until Trim(ActiveCell.Value) = ""
Account = Trim(ActiveCell.Value)
StoreCol = ActiveCell.Column
If Len(Account) <> 11 Then
MsgBox "Please check the Account is correct in cell " & ActiveCell.Address, vbInformation, "Account Incorrect"
End
Else
'Stores the cell location of the Account
StoreLocation = ActiveCell.Address
Call ZINTS
Cells(NewRow, StoreCol).Select
Call Data_Into_Spreadsheet
Call IA_Adjustment
Else
End If
Range(StoreLocation).Select
ActiveCell.Offset(0, 5).Select
End If
Loop
ActiveCell.Offset(-1, -1).Select
Loop
Next I
MsgBox "Finished, please check for any errors", vbInformation, "Finished"
[C1].Select
End Sub
After a weekend, it currently inserts 3 rows and Calls 'IA_Adjustment' after each row. However, I want it to only Call 'IA_Adjustment' after the third row is inserted.
The variable that stores the number of rows is 'I'
I think I need another Do Until Loop but I'm not sure where it would go. Can anybody advise?
[D8].Select
Do Until Trim(ActiveCell.Value) = ""
Cusip = Trim(ActiveCell.Value)
If Len(Cusip) <> 9 Then
MsgBox "Please check the cusip is correct in cell " & ActiveCell.Address, vbInformation, "Cusip Incorrect"
End
Else
End If
ActiveCell.Offset(1, 3).Select
Do Until Trim(ActiveCell.Value) = ""
Account = Trim(ActiveCell.Value)
StoreCol = ActiveCell.Column
If Len(Account) <> 11 Then
MsgBox "Please check the Account is correct in cell " & ActiveCell.Address, vbInformation, "Account Incorrect"
End
Else
'Stores the cell location of the Account
StoreLocation = ActiveCell.Address
Call ZINTS
Cells(NewRow, StoreCol).Select
Call Data_Into_Spreadsheet
Call IA_Adjustment
Else
End If
Range(StoreLocation).Select
ActiveCell.Offset(0, 5).Select
End If
Loop
ActiveCell.Offset(-1, -1).Select
Loop
Next I
MsgBox "Finished, please check for any errors", vbInformation, "Finished"
[C1].Select
End Sub