View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
plumfin plumfin is offline
external usenet poster
 
Posts: 7
Default Only show cells if they have data in them

Thanks Cerberus, I must be having a dim day - what is Option Explicit? Also,
should i copy this text exactly and paste it into my spreadsheet? thanks,
Kelly

"Cerberus" wrote:

I have used this one before, it may work for you also.

Option Explicit

Private Sub Worksheet_Activate()

Dim HiddenRow&, RowRange As Range

'< Set the column that contains data
Const DataCol As String = "A"

'*****************************

ActiveWindow.DisplayZeros = False
Application.ScreenUpdating = False

For HiddenRow = 1 To ActiveSheet.UsedRange.Rows.Count

'Take the Length of the value in column A of each row
If Len(Range(DataCol & HiddenRow).Value) < 0 Then
'there's something in this row - don't hide
Rows(HiddenRow).EntireRow.Hidden = False
Else
'there's nothing in this row yet - hide it
Rows(HiddenRow).EntireRow.Hidden = True
End If

Next HiddenRow

Application.ScreenUpdating = True

End Sub


"plumfin" wrote:

I am designing a price list, which different branches will use different
options on, ie, some will offer products A and C, but not product B; others
will offer all 3. I am struggling to work out how to design this as a macro.
The idea would be that if they "tick" A, B and C, then they would then be
promted to put in some prices, which would in turn generate further
discounted price lists. Any ideas? thanks, Kelly