PDA

View Full Version : Hint about VBA functions



Cavaliere
03-28-2010, 08:36 AM
Hi everybody,

Is there any function in VB that represents the following loop


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"


Thanks in advance

mdmackillop
03-28-2010, 08:43 AM
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

Cavaliere
03-28-2010, 08:49 AM
Thanks for help