PC Review


Reply
Thread Tools Rate Thread

Count no empty cells at the right of a selection

 
 
avi
Guest
Posts: n/a
 
      7th Jul 2011
Hello,

I am looking for a robust code that will count no empty cells at the
right of a selection

Using Range(Selection, Selection.End(xlToRight)).Select seems to
capture all the cells only the next block and not all the columns at
the right

Thanks
Avi

 
Reply With Quote
 
 
 
 
Claus Busch
Guest
Posts: n/a
 
      7th Jul 2011
Hello Avi,

Am Thu, 7 Jul 2011 09:58:50 -0700 (PDT) schrieb avi:

> Using Range(Selection, Selection.End(xlToRight)).Select seems to
> capture all the cells only the next block and not all the columns at
> the right


try:
myCount = Selection.Cells.Count - _
WorksheetFunction.CountBlank(Selection.Offset(0, 1))


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
 
Reply With Quote
 
Gord Dibben
Guest
Posts: n/a
 
      7th Jul 2011
Sub select_to_lastcolumn()
'select to last filled column in activerow, ignoring intermediate blanks
Range(ActiveCell, Cells(ActiveCell.Row, Columns.Count).End(xlToLeft)).Select
End Sub

What the code does is start from far right column then work back until it
reaches the first non-blank cell.


Gord Dibben MS Excel MVP

On Thu, 7 Jul 2011 09:58:50 -0700 (PDT), avi <(E-Mail Removed)> wrote:

>Hello,
>
>I am looking for a robust code that will count no empty cells at the
>right of a selection
>
>Using Range(Selection, Selection.End(xlToRight)).Select seems to
>capture all the cells only the next block and not all the columns at
>the right
>
>Thanks
>Avi

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro for filling in empty cells in selection Floris Blaauboer Microsoft Excel Discussion 6 14th Dec 2006 05:23 PM
Count Empty Cells in Range After Cells with Data =?Utf-8?B?RGF2aWQ=?= Microsoft Excel Programming 16 17th Sep 2006 03:03 PM
Count Only Empty Cells AFTER Cells with Data =?Utf-8?B?RGF2aWQ=?= Microsoft Excel Worksheet Functions 2 15th Sep 2006 06:05 PM
Message - Selection contains empty cells al007 Microsoft Excel Programming 2 28th Nov 2005 11:07 AM
Selection of non-empty cells Adrian Microsoft Excel Programming 6 22nd Jul 2004 01:06 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:19 AM.