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 here:
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