From: Valeria on 29 Apr 2010 06:35 Dear experts, what is the quickest VBA way to determine in a big cells range if at least one of them is non empty? Many thanks for your help! Best regards -- Valeria
From: Jacob Skaria on 29 Apr 2010 06:51 Does this help.. Set varRange = Selection.Find("*") If Not varRange Is Nothing Then MsgBox "Data exist in this range" -- Jacob (MVP - Excel) "Valeria" wrote: > Dear experts, > what is the quickest VBA way to determine in a big cells range if at least > one of them is non empty? > Many thanks for your help! > Best regards > > -- > Valeria
From: Mike H on 29 Apr 2010 06:53 Hi, This tells you the empty cells in a range and you can modify this easily to tell you how many cells are not empty If WorksheetFunction.CountA(Range("A1:c1000")) = _ Range("A1:C1000").Cells.Count Then MsgBox "No empty cells" Else num = Range("A1:C1000").Cells.Count - _ WorksheetFunction.CountA(Range("A1:c1000")) MsgBox num & " Empty cells in range" End If -- Mike When competing hypotheses are otherwise equal, adopt the hypothesis that introduces the fewest assumptions while still sufficiently answering the question. "Valeria" wrote: > Dear experts, > what is the quickest VBA way to determine in a big cells range if at least > one of them is non empty? > Many thanks for your help! > Best regards > > -- > Valeria
From: Valeria on 29 Apr 2010 07:23 Works very well, thank you very much! -- Valeria "Jacob Skaria" wrote: > Does this help.. > > > Set varRange = Selection.Find("*") > If Not varRange Is Nothing Then MsgBox "Data exist in this range" > > -- > Jacob (MVP - Excel) > > > "Valeria" wrote: > > > Dear experts, > > what is the quickest VBA way to determine in a big cells range if at least > > one of them is non empty? > > Many thanks for your help! > > Best regards > > > > -- > > Valeria
From: Rick Rothstein on 29 Apr 2010 10:42 You didn't have to set the Find call to a variable before testing for data in the range; this works the same way your code does... If Not Selection.Find("*") Is Nothing Then MsgBox "Data exist in the range" -- Rick (MVP - Excel) "Jacob Skaria" <JacobSkaria(a)discussions.microsoft.com> wrote in message news:7F9C99BD-9B03-49E5-BC5A-5CFDA60B9B09(a)microsoft.com... > Does this help.. > > > Set varRange = Selection.Find("*") > If Not varRange Is Nothing Then MsgBox "Data exist in this range" > > -- > Jacob (MVP - Excel) > > > "Valeria" wrote: > >> Dear experts, >> what is the quickest VBA way to determine in a big cells range if at >> least >> one of them is non empty? >> Many thanks for your help! >> Best regards >> >> -- >> Valeria
|
Pages: 1 Prev: Check to see if subtotal is expanded Next: Click Excel custom menu item via MFC automation |