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