Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

spaces data source

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Spaces in data source

Spaces in data source

ResolvedVersion 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 courses

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
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Excel tip:

Adding a comment to a formula

1. At the end of the formula, add a + (plus) sign.
2. Type the letter N, and in parentheses, type your comment in quotation marks.

eg.

=CurrentAssets / CurrentLiabilities+ N("The formula returns Current Ratio")

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.11 secs.