-
Hint about VBA functions
Hi everybody,
Is there any function in VB that represents the following loop
[vba]
w = 0
For k = 1 To ActiveSheet.UsedRange.Columns.Count
If ActiveSheet.Cells(2, k) = Empty Then
w = w + 1
End If
Next k
if w < ActiveSheet.UsedRange.Columns.Count then
MsgBox "Row is not Empty"
[/vba]
Thanks in advance
-
[VBA]Dim Rng As Range, msg As String
With ActiveSheet
Set Rng = Intersect(.Rows(2), .UsedRange)
If Application.CountA(Rng) < Rng.Cells.Count Then
msg = "Not empty"
Else
msg = "Empty"
End If
End With
MsgBox msg
[/VBA]
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules