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

excel microsoft training - vba excel

Forum home » Delegate support and help forum » Microsoft Excel Training and help » excel microsoft training - VBA for excel

excel microsoft training - VBA for excel

ResolvedVersion Standard

Sven has attended:
Excel VBA Intro Intermediate course

VBA for excel

How can I count empty cells in a row or column? How can I use VBA to export data from excel (a table)to a word application?

RE: VBA for excel

Hi Sven

Thank you for your question

For the first part, here is some code that should meet your needs. Note that it specifies the worksheet (data sheet) and range (data) of the cells to be checked

Public Sub GapCounter()


Dim aRange As Range
Dim i As Integer
Dim j As Integer
Dim Blanks As Integer

Worksheets("data sheet").Activate

Set aRange = Range("data")
Blanks = 0

For i = 1 To aRange.Columns.Count 'cycles through the columns
For j = 1 To aRange.Rows.Count 'within each column cycles through the rows
If IsEmpty(aRange.Cells(j, i)) Then
Blanks = Blanks + 1 'if the cell is empty, increases number of blanks by 1
End If
Next j
Next i

MsgBox ("There are " & Blanks & " Blank Cells in the range")


End Sub


As regards the second part of the question. Do you wish to amend the data once it is transfered into word? Or dio you simply wish a picture of the table to appear in the document?

Regards

Stephen

Excel tip:

New to Excel 2010 - Sparklines!

Excel 2010 includes a new feature called Sparklines which are tiny charts that fit into a single cell and plot data in cells from the worksheet. There are a host of formatting and styles that can be applied to them and they are really quite interesting.

>insert
>sparklines
>Choose any style you want

You will be asked for the range and it will automatically select the cell your in to insert the sparklines.

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.