98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Spaces in data source
Spaces in data source
Resolved · Low Priority · Version 2007
Barry has attended:
Excel VBA Intro Intermediate course
Spaces in data source
Hi Guys
Wonder if you can help me.
I have a range of data with phone records which need to be counted by service number then data filled into another sheet.
This sheet has a list of numbers down the left hand side which some are broken up by blank rows.
I need the macro to jump over these blank rows and continue to search through the service numbers until there are no more.
The problem i have is i cant use range due to these spaces and can't remove the spaces.
Any help would be greatful.
Cheers
RE: Spaces in data source
Hi Barry, thanks for your query. Here's some rather rough code to count items in a range, skipping blank rows:
-----------------------------
Sub test()
Dim introwcount As Long
Dim mycounter As Integer
mycounter = 0
For introwcount = 1 To 65000
If Cells(introwcount, 1).Value <> "" Then
mycounter = mycounter + 1
End If
Next introwcount
MsgBox mycounter
End Sub
-----------------------------
Hope this helps,
Anthony
Training information:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Excel tip:Repeating headings on spreadsheets that print on more than one pageBy default when you print a spreadsheet out and it prints on more than one page, the headings at the top and the side of the spreadsheet don't appear on all the pages following page 1. |