Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
count number of non empty columns
Hi! I am trying to count the number of non empty columns of a named range. I
use this "method" for rows and that works fine but I have trouble getting it to work for columns (I only get 0 number of columns). Set rngPL = ThisWorkbook.Sheets("P&L Matrix").Range("PL") Dim NoRPL As Long Dim NoCPL As Long NoRPL = rngPL(1).End(xlDown).Row - rngPL(1).Row + 1 'number of rows NoCPL = rngPL.End(xlRight).Column - rngPL.Column + 1 It is the last row that is for columns but it does not work. Would be most gratefuk for any help! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
count number of non empty columns
Hi Arne
Just a little typo i think if you change from xlRight to xlToRight you should have more luck Laterz S |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
count number of non empty columns
You might like these??
lr = Range("testrng").Cells.Find(what:="*", _ SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row lc = Range("testrng").Cells.Find(what:="*", _ SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column MsgBox lr MsgBox lc -- Don Guillett Microsoft MVP Excel SalesAid Software "Arne Hegefors" wrote in message ... Hi! I am trying to count the number of non empty columns of a named range. I use this "method" for rows and that works fine but I have trouble getting it to work for columns (I only get 0 number of columns). Set rngPL = ThisWorkbook.Sheets("P&L Matrix").Range("PL") Dim NoRPL As Long Dim NoCPL As Long NoRPL = rngPL(1).End(xlDown).Row - rngPL(1).Row + 1 'number of rows NoCPL = rngPL.End(xlRight).Column - rngPL.Column + 1 It is the last row that is for columns but it does not work. Would be most gratefuk for any help! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to count the number of cells not empty? | Excel Discussion (Misc queries) | |||
Count the number of columns on row that are not empty within a ran | Excel Discussion (Misc queries) | |||
count number of duplicates between 2 columns | Excel Discussion (Misc queries) | |||
Pivot Table - How do I count number of columns? | Excel Discussion (Misc queries) | |||
To find number of non-empty cells across columns | Excel Programming |