A Thayuman
New Member
- Joined
- Mar 6, 2019
- Messages
- 30
Hi
I would like to know how many empty rows are below each cell with data. Coloum "B" has data - number of empty cells should appear in coloum "A"
I have found this code in one of the forum messages however the code works but I get -
The Microsoft Visual Basic Window pops up - "Rum-time error '6': Overflow
When I hit debug it shows be the error is in "NextName = Range("B" & Counter).End(xlDown).Row"
Sub CountEmpty()
Dim LastRow As Integer
Dim Counter As Integer
Dim NextName As Integer
LastRow = Range("B" & Rows.Count).End(xlUp).Row
For Counter = 2 To LastRow
If Range("B" & Counter).Value = "" Then GoTo NextTry
NextName = Range("B" & Counter).End(xlDown).Row
Range("A" & Counter).Value = NextName - Counter - 1
NextTry:
Next Counter
End Sub
I hope to hear from one of the experts
I would like to know how many empty rows are below each cell with data. Coloum "B" has data - number of empty cells should appear in coloum "A"
I have found this code in one of the forum messages however the code works but I get -
The Microsoft Visual Basic Window pops up - "Rum-time error '6': Overflow
When I hit debug it shows be the error is in "NextName = Range("B" & Counter).End(xlDown).Row"
Sub CountEmpty()
Dim LastRow As Integer
Dim Counter As Integer
Dim NextName As Integer
LastRow = Range("B" & Rows.Count).End(xlUp).Row
For Counter = 2 To LastRow
If Range("B" & Counter).Value = "" Then GoTo NextTry
NextName = Range("B" & Counter).End(xlDown).Row
Range("A" & Counter).Value = NextName - Counter - 1
NextTry:
Next Counter
End Sub
I hope to hear from one of the experts
VBA to add rows.xlsm | |||||||||
---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | |||
1 | Empty Cells | Date | Transaction Details | Notes 1 | Notes 2 | Debit | Credit | ||
2 | 2 | 02-Jan-00 | Julia Linsyd stay | R4446544180 | Transfer Debit | -210.00 | |||
3 | |||||||||
4 | |||||||||
5 | 5 | 08-Jan-00 | OPTUS BILLING SVC... | INTERNET BPAY | Transfer Debit | -87.20 | |||
6 | |||||||||
7 | |||||||||
8 | |||||||||
9 | |||||||||
10 | |||||||||
11 | 5 | 07-Jan-00 | ST.GEORGE BANK-C... | 1234 | Automatic Drawing | -418.70 | |||
12 | |||||||||
13 | |||||||||
14 | |||||||||
15 | |||||||||
16 | |||||||||
17 | 9 | 07-Jan-00 | HIRE PURCHASE... | 0000000237300845 | Automatic Drawing | -430.17 | |||
18 | |||||||||
19 | |||||||||
20 | |||||||||
21 | |||||||||
22 | |||||||||
23 | |||||||||
24 | |||||||||
25 | |||||||||
26 | |||||||||
27 | 7 | 07-Jan-00 | LIMIT RATE IS 8.820... | Miscellaneous Credit | 0.00 | ||||
Sheet1 |
Last edited: