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 Training and help » excel microsoft training - VBA for excel
excel microsoft training - VBA for excel
Resolved · Low Priority · Version 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
Training information:
See also:
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:Get back to active cellIf you have scrolled away from the active celland want to get back t it quicly you can Ctrl and Backspace to get back |