View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.newusers
pcor pcor is offline
external usenet poster
 
Posts: 148
Default Select NON blank cells

You went thru a pile of work to explain this to me... and I really appreciate
tihis and I think I did not explain myself very well.
My sheet conatins the folloiwng:

A B
c D
Name Address 12 Jan 2006
19 Jan 2006
Niceguy his address is here 2.00
5.00
Niceer guy HIS ADDRESS GOES HERE 4.00
not nice addess
2.50
Other guy address 12.00
1.25
The column beyond D are all dates during thsi year.
Here is what I would like
I place my cursor on any cell in col c and then hit a macro to show me only
the entries that contain data
In effect this would do that same as clcicking onf the filter arrow and
selection NON BLANK
Thanks in advance.
"JLatham" wrote:

Before doing this, need to know exactly what you want to show.

You said "..click in cell b5, then I want only the non blank cells in col
5..."

When you are in cell B5, the COLUMN you are in is B (or column 2) and the
ROW you are in is row 5.

Do you want the column or the row information to remain visible?

By the way, you probably don't want this to happen when you simply choose a
cell, probably be best to require a double-click in a cell to make it happen.

The VBA code will need to be associated with a Worksheet's event (as
_BeforeDoubleClick) - do you know how to put that kind of code into your
workbook or will you need instructions?

On the off chance that you meant COLUMN instead of ROW, and that you can get
the code into the proper place, heres code that will do it for the column.
And instructions for putting it in the worksheet code can be found he
http://www.jlathamsite.com/Teach/WorksheetCode.htm

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Dim thisColumn As String

If Target.Cells.Count 1 Then
Exit Sub ' only on single cell select
End If
Application.EnableEvents = False
Cancel = True
thisColumn = Left(Target.Address, InStr(2, Target.Address, "$") - 1) _
& ":" & Left(Target.Address, InStr(2, Target.Address, "$") - 1)
Columns(thisColumn).Select
Selection.EntireRow.Hidden = False
Range(thisColumn & ":" & thisColumn).SpecialCells(xlCellTypeBlanks).Select
Selection.EntireRow.Hidden = True
Application.EnableEvents = True
End Sub



"pcor" wrote:

I want to click on a cell and have only the cells that contain data in that
colum to be visible.(Lets assume I click in cell b5, then I want only the non
blank cells in col 5 to be visible)(ie the same as using "SELECT all NON
BLANK cells)
But I want a macro to do this. Any help will be appreciated
Thanks
Ian