Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If I use: =IF(Sheet2!D22,Sheet2!D22,"") in column A (with no value)
The code below works. IfI use: =Sheet2!D22 in column A (with no value) The code does not work. Why? Thanks, Bob Private Sub CommandButton1_Click() Dim rw As Long Application.ScreenUpdating = False 'Me is the object that owns the code 'in this case Sheet1 With Me 'Sheets("Sheet1") For rw = 1 To 30 If .Cells(rw, "A").Value = "" Then _ .Rows(rw).Hidden = True Next rw .PrintOut ' for testing use .PrintPreview .Range("A1:A30").EntireRow.Hidden = False End With Application.ScreenUpdating = True End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub hiderows()
with yoursheet ..Columns(1).SpecialCells(xlBlanks).EntireRow.Hidd en = True ..rows.visible=true end with End Sub -- Don Guillett SalesAid Software "Bob" wrote in message ... If I use: =IF(Sheet2!D22,Sheet2!D22,"") in column A (with no value) The code below works. IfI use: =Sheet2!D22 in column A (with no value) The code does not work. Why? Thanks, Bob Private Sub CommandButton1_Click() Dim rw As Long Application.ScreenUpdating = False 'Me is the object that owns the code 'in this case Sheet1 With Me 'Sheets("Sheet1") For rw = 1 To 30 If .Cells(rw, "A").Value = "" Then _ .Rows(rw).Hidden = True Next rw .PrintOut ' for testing use .PrintPreview .Range("A1:A30").EntireRow.Hidden = False End With Application.ScreenUpdating = True End Sub |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
For the OP,
This wouldn't work for either of the formulas you show as being in column A. A cell containing a formula is not considered blank. -- Regards, Tom Ogilvy "Don Guillett" wrote in message ... change to Sub hiderows() With ActiveSheet .Columns(1).SpecialCells(xlBlanks).EntireRow.Hidde n = True .PrintPreview .Rows.Hidden = False End With End Sub -- Don Guillett SalesAid Software "Don Guillett" wrote in message ... Sub hiderows() with yoursheet .Columns(1).SpecialCells(xlBlanks).EntireRow.Hidde n = True .rows.visible=true end with End Sub -- Don Guillett SalesAid Software "Bob" wrote in message ... If I use: =IF(Sheet2!D22,Sheet2!D22,"") in column A (with no value) The code below works. IfI use: =Sheet2!D22 in column A (with no value) The code does not work. Why? Thanks, Bob Private Sub CommandButton1_Click() Dim rw As Long Application.ScreenUpdating = False 'Me is the object that owns the code 'in this case Sheet1 With Me 'Sheets("Sheet1") For rw = 1 To 30 If .Cells(rw, "A").Value = "" Then _ .Rows(rw).Hidden = True Next rw .PrintOut ' for testing use .PrintPreview .Range("A1:A30").EntireRow.Hidden = False End With Application.ScreenUpdating = True End Sub |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Everyone:
If I use: =IF(Sheet2!D22,Sheet2!D22,"") in column A (with no value) The code below works the other suggestions don't. The problem is this, In sheet "Production" I am actually using: Column A Column B,C,D,E,F =PreProduction!$H130 =IF($A130,Forecast!$B130,0) I am doing that because if I use: =IF(PreProduction!H22,PreProduction!D22,"") In column A - Column B,C,D,E,F will have an error. But the code will work. Are there any other suggestions? Bob "Tom Ogilvy" wrote: For the OP, This wouldn't work for either of the formulas you show as being in column A. A cell containing a formula is not considered blank. -- Regards, Tom Ogilvy "Don Guillett" wrote in message ... change to Sub hiderows() With ActiveSheet .Columns(1).SpecialCells(xlBlanks).EntireRow.Hidde n = True .PrintPreview .Rows.Hidden = False End With End Sub -- Don Guillett SalesAid Software "Don Guillett" wrote in message ... Sub hiderows() with yoursheet .Columns(1).SpecialCells(xlBlanks).EntireRow.Hidde n = True .rows.visible=true end with End Sub -- Don Guillett SalesAid Software "Bob" wrote in message ... If I use: =IF(Sheet2!D22,Sheet2!D22,"") in column A (with no value) The code below works. IfI use: =Sheet2!D22 in column A (with no value) The code does not work. Why? Thanks, Bob Private Sub CommandButton1_Click() Dim rw As Long Application.ScreenUpdating = False 'Me is the object that owns the code 'in this case Sheet1 With Me 'Sheets("Sheet1") For rw = 1 To 30 If .Cells(rw, "A").Value = "" Then _ .Rows(rw).Hidden = True Next rw .PrintOut ' for testing use .PrintPreview .Range("A1:A30").EntireRow.Hidden = False End With Application.ScreenUpdating = True End Sub |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
=ISBLANK(Sheet2!A8)
will test if the source cell (sheet2!A8 in the example) is blank. Perhaps you can use this knowledge to craft a solution. -- Regards, Tom Ogilvy "Bob" wrote: Everyone: If I use: =IF(Sheet2!D22,Sheet2!D22,"") in column A (with no value) The code below works the other suggestions don't. The problem is this, In sheet "Production" I am actually using: Column A Column B,C,D,E,F =PreProduction!$H130 =IF($A130,Forecast!$B130,0) I am doing that because if I use: =IF(PreProduction!H22,PreProduction!D22,"") In column A - Column B,C,D,E,F will have an error. But the code will work. Are there any other suggestions? Bob "Tom Ogilvy" wrote: For the OP, This wouldn't work for either of the formulas you show as being in column A. A cell containing a formula is not considered blank. -- Regards, Tom Ogilvy "Don Guillett" wrote in message ... change to Sub hiderows() With ActiveSheet .Columns(1).SpecialCells(xlBlanks).EntireRow.Hidde n = True .PrintPreview .Rows.Hidden = False End With End Sub -- Don Guillett SalesAid Software "Don Guillett" wrote in message ... Sub hiderows() with yoursheet .Columns(1).SpecialCells(xlBlanks).EntireRow.Hidde n = True .rows.visible=true end with End Sub -- Don Guillett SalesAid Software "Bob" wrote in message ... If I use: =IF(Sheet2!D22,Sheet2!D22,"") in column A (with no value) The code below works. IfI use: =Sheet2!D22 in column A (with no value) The code does not work. Why? Thanks, Bob Private Sub CommandButton1_Click() Dim rw As Long Application.ScreenUpdating = False 'Me is the object that owns the code 'in this case Sheet1 With Me 'Sheets("Sheet1") For rw = 1 To 30 If .Cells(rw, "A").Value = "" Then _ .Rows(rw).Hidden = True Next rw .PrintOut ' for testing use .PrintPreview .Range("A1:A30").EntireRow.Hidden = False End With Application.ScreenUpdating = True End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Execute VB code depending on time of day | Excel Discussion (Misc queries) | |||
VBA code to automatically colour cells depending on text? | Excel Discussion (Misc queries) | |||
fomula which returns the amount depending on the currency code | Excel Discussion (Misc queries) | |||
Obtain rate for work center, depending on year | Excel Worksheet Functions | |||
Select stock code depending on description in next column | Excel Worksheet Functions |