Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7
Default Only show cells if they have data in them

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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 88
Default Only show cells if they have data in them

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

  #3   Report Post  
Posted to microsoft.public.excel.misc
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

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 88
Default Only show cells if they have data in them

Sorry, you don't need the Option Explicit part. You would want to go in to
the VBE (Alt+F11) and click on the sheet you want to show only the cells that
have info. You will find the sheets in the Microsoft Excel Objects folder in
the VBAProject area on the left hand side of your screen. Once you "click"
on the sheet, paste the code in the General field. With this code, once the
sheet has been opened all your blank cells will be hidden.

"plumfin" wrote:

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

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7
Default Only show cells if they have data in them

I am struggling to leave all the cells blank, ie, I have some showing a
negative number when I really want them to be blank. Do you know how I can
do this? Also, where does the General Field start on the VBA, and do I need
to edit any of your text with anything at all? Many thanks, I will get this
done eventually!

"Cerberus" wrote:

Sorry, you don't need the Option Explicit part. You would want to go in to
the VBE (Alt+F11) and click on the sheet you want to show only the cells that
have info. You will find the sheets in the Microsoft Excel Objects folder in
the VBAProject area on the left hand side of your screen. Once you "click"
on the sheet, paste the code in the General field. With this code, once the
sheet has been opened all your blank cells will be hidden.

"plumfin" wrote:

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



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 88
Default Only show cells if they have data in them

No problem, Im pretty new at this myself. The general field is the large
blank area in the middle of the VBA page.

Now since Im kinda new to this also, I would write a simple formula that
say something like =IF(A1<1,"",your formula) so your any value less than 1
leaves you a blank cell. Im sure there is a more efficient way but I have
not come across it yet.


"plumfin" wrote:

I am struggling to leave all the cells blank, ie, I have some showing a
negative number when I really want them to be blank. Do you know how I can
do this? Also, where does the General Field start on the VBA, and do I need
to edit any of your text with anything at all? Many thanks, I will get this
done eventually!

"Cerberus" wrote:

Sorry, you don't need the Option Explicit part. You would want to go in to
the VBE (Alt+F11) and click on the sheet you want to show only the cells that
have info. You will find the sheets in the Microsoft Excel Objects folder in
the VBAProject area on the left hand side of your screen. Once you "click"
on the sheet, paste the code in the General field. With this code, once the
sheet has been opened all your blank cells will be hidden.

"plumfin" wrote:

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

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

Thanks for the help on the blank cells - just one question on the actual row
formula, should I copy it word for word as you have written it? When I tried
it, it gave me an error and I don't know what to change. thanks, Kelly

"Cerberus" wrote:

No problem, Im pretty new at this myself. The general field is the large
blank area in the middle of the VBA page.

Now since Im kinda new to this also, I would write a simple formula that
say something like =IF(A1<1,"",your formula) so your any value less than 1
leaves you a blank cell. Im sure there is a more efficient way but I have
not come across it yet.


"plumfin" wrote:

I am struggling to leave all the cells blank, ie, I have some showing a
negative number when I really want them to be blank. Do you know how I can
do this? Also, where does the General Field start on the VBA, and do I need
to edit any of your text with anything at all? Many thanks, I will get this
done eventually!

"Cerberus" wrote:

Sorry, you don't need the Option Explicit part. You would want to go in to
the VBE (Alt+F11) and click on the sheet you want to show only the cells that
have info. You will find the sheets in the Microsoft Excel Objects folder in
the VBAProject area on the left hand side of your screen. Once you "click"
on the sheet, paste the code in the General field. With this code, once the
sheet has been opened all your blank cells will be hidden.

"plumfin" wrote:

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I show the query name in the worksheet over the data cells Dancer52 Excel Discussion (Misc queries) 0 March 10th 08 08:01 PM
how do i sort a worksheet data to show repetitve data and show mrcheatherington Excel Worksheet Functions 1 December 30th 07 02:26 PM
one column of cells show ####. Values show when I open it. Help grantljg Excel Discussion (Misc queries) 3 September 18th 07 09:19 PM
XL2003, how can I set the view to show only the cells with data S Thomas Setting up and Configuration of Excel 3 September 18th 06 04:56 PM
Pivot table blank cells show data deleted months ago! vcard Excel Discussion (Misc queries) 0 April 25th 06 09:25 PM


All times are GMT +1. The time now is 02:25 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"