I am trying to count the number of non-blank cells in columns B-F and paste the value in column H. I am trying to define the range for each row but can't get the syntax correct. Any help appreciated. Thanks.
Sub aa() LastRow = Cells(Rows.Count, 1).End(xlUp).Row For x = 2 To LastRow Agents = WorksheetFunction.CountA(Range("B" & x).("F" & x) Range("H" & x) = Agents Next End Sub
Last edited by maacmaac; 01-07-2012 at 04:24 PM.
Perhaps try:
or justAgents = WorksheetFunction.CountA(Range("B" & x & ":F" & x)) Range("H" & x).Value = Agents
Range("H" & x).Value = WorksheetFunction.CountA(Range("B" & x & ":F" & x))
Sub snb() for each cl in columns(1).specialcells(2) cells(cl.row,8)=cl.entirerow.specialcells(2).count next End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks