Hello,
How do I write code to move on to another question if the information doesn't exist on my spreadsheet? My code is:
'Select Start of range
Range("B1").Select
While ActiveCell.Value <> ""
'This writes 'Cash' in column A against cash transactions.
If ActiveCell.Value <> "" Then ActiveCell.Offset(0, -1).Value = "Cash"
ActiveCell.Offset(1, 0).Select
Wend
'Select Start of range
Columns("B:B").Select
Selection.Find(What:="Cheque", After:=Range("B1"), LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False).Select
While ActiveCell.Value <> ""
'This writes 'Cheque' in column A against cheque transactions.
If ActiveCell.Value <> "" Then ActiveCell.Offset(0, -1).Value = "Cheque"
ActiveCell.Offset(1, 0).Select
Wend
'Select Start of range
Columns("B:B").Select
Selection.Find(What:="EFT", After:=Range("B1"), LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False).Select
While ActiveCell.Value <> ""
'This writes 'EFT' in column A against EFT transactions.
If ActiveCell.Value <> "" Then ActiveCell.Offset(0, -1).Value = "EFT"
ActiveCell.Offset(1, 0).Select
Wend
The highlighted area in blue above comes back with a run-time error '91': Object variable or With block variable not set.
I hope you can help me move on to my next search criteria. There will be a number of times when Cheques will not exist on the report and maybe EFT from time to time, although rare.
Best wishes,
Peggy
<tbody>
</tbody>
How do I write code to move on to another question if the information doesn't exist on my spreadsheet? My code is:
'Select Start of range
Range("B1").Select
While ActiveCell.Value <> ""
'This writes 'Cash' in column A against cash transactions.
If ActiveCell.Value <> "" Then ActiveCell.Offset(0, -1).Value = "Cash"
ActiveCell.Offset(1, 0).Select
Wend
'Select Start of range
Columns("B:B").Select
Selection.Find(What:="Cheque", After:=Range("B1"), LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False).Select
While ActiveCell.Value <> ""
'This writes 'Cheque' in column A against cheque transactions.
If ActiveCell.Value <> "" Then ActiveCell.Offset(0, -1).Value = "Cheque"
ActiveCell.Offset(1, 0).Select
Wend
'Select Start of range
Columns("B:B").Select
Selection.Find(What:="EFT", After:=Range("B1"), LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False).Select
While ActiveCell.Value <> ""
'This writes 'EFT' in column A against EFT transactions.
If ActiveCell.Value <> "" Then ActiveCell.Offset(0, -1).Value = "EFT"
ActiveCell.Offset(1, 0).Select
Wend
The highlighted area in blue above comes back with a run-time error '91': Object variable or With block variable not set.
I hope you can help me move on to my next search criteria. There will be a number of times when Cheques will not exist on the report and maybe EFT from time to time, although rare.
Best wishes,
Peggy
A | B | |
1 | Cash | Cash |
2 | Cash | Stationery |
3 | Cash | Cards |
4 | ||
7 | EFT | EFT |
8 | EFT | Cards |
9 | EFT | Calendars |
10 | EFT | Pencils |
11 | ||
12 |
<tbody>
</tbody>