spaces data source
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

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

Spaces in data source

resolvedResolved · Low Priority · Version 2007

replyReply Mon 7 Nov 2011, 12:35Delegate Barry said...

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

For upcoming training course dates see: Pricing & availability

replyReply Thu 10 Nov 2011, 10:52Trainer Anthony said...

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

 

Please browse our web site to find out more about
advanced excel training and other Microsoft training courses.

Excel tip:

Importing Numbers in Excel 2010

Occasionally, when importing data into Excel you find that the some of the imported values are treated as text.

To convert these numbers to actual values, click on an empty cell and press Ctrl+C.

Next, select the range that contains the values you need to change and in the Clipboard Group on the Home tab, click the Paste drop-down arrow and choose Paste Special. In the Paste Special dialog box, select Add and then click OK.

View all Excel hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard