Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default Print rows of missing info

Hi,
I have a RANGE "Employees" with some missing info:

Column A Columns B Column C
21823059 גדעון לי*א 474
27640374 מיעארי טארק 474
36095008 מורא*י רים 474
15786791 פוקס מיכל blank cell
27820257 הראל שלומציון blank cell
28488567 אר*פרוי*ד רו*ית blank cell

I would like that IF NO blank cells in Range THEN continue MACRO

but IF blank cells in Range THEN "print" value of cells A and B and Exit
both Worksheet and Excel.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Print rows of missing info

Here you go Helmut:

Sub PrintAndExitIfBlankEmplyeeData()

Dim rng As Range
Set rng = Range("Employees")
If rng.SpecialCells(xlCellTypeBlanks).Cells.Count < 0 Then
Range("Employees").Resize(, 2).PrintOut
Application.DisplayAlerts = False
Application.Quit
End If

End Sub

"Helmut" wrote:

Hi,
I have a RANGE "Employees" with some missing info:

Column A Columns B Column C
21823059 גדעון לי*א 474
27640374 מיעארי טארק 474
36095008 מורא*י רים 474
15786791 פוקס מיכל blank cell
27820257 הראל שלומציון blank cell
28488567 אר*פרוי*ד רו*ית blank cell

I would like that IF NO blank cells in Range THEN continue MACRO

but IF blank cells in Range THEN "print" value of cells A and B and Exit
both Worksheet and Excel.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default Print rows of missing info

Hi DomThePom,
Great BUT it prints not only the rows with the BLANK CELL but it prints the
whole worksheet. I only want to print the rows with the blank cells.
thanks
Helmut

"DomThePom" wrote:

Here you go Helmut:

Sub PrintAndExitIfBlankEmplyeeData()

Dim rng As Range
Set rng = Range("Employees")
If rng.SpecialCells(xlCellTypeBlanks).Cells.Count < 0 Then
Range("Employees").Resize(, 2).PrintOut
Application.DisplayAlerts = False
Application.Quit
End If

End Sub

"Helmut" wrote:

Hi,
I have a RANGE "Employees" with some missing info:

Column A Columns B Column C
21823059 גדעון לי*א 474
27640374 מיעארי טארק 474
36095008 מורא*י רים 474
15786791 פוקס מיכל blank cell
27820257 הראל שלומציון blank cell
28488567 אר*פרוי*ד רו*ית blank cell

I would like that IF NO blank cells in Range THEN continue MACRO

but IF blank cells in Range THEN "print" value of cells A and B and Exit
both Worksheet and Excel.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Print rows of missing info

Ask and ye......

Sub PrintAndExitIfBlankEmplyeeData()
Dim rngRow As Range
Dim rng As Range
Set rng = Range("Employees")
If CountBlanksCells(rng) < 0 Then

'hide complete rows
For Each rngRow In rng.Rows
'exclude first row
If rngRow.row < 1 Then
If CountBlanksCells(rngRow) = 0 Then
rngRow.EntireRow.Hidden = True
End If
End If
Next rngRow
Range("Employees").Resize(, 2).PrintOut
Application.DisplayAlerts = False
Application.Quit
End If

End Sub

Function CountBlanksCells(ByRef rng As Range) As Long
Dim lngCount As Long
On Error Resume Next
lngCount = rng.SpecialCells(xlCellTypeBlanks).Cells.Count
If Err.Number = 0 Then
CountBlanksCells = lngCount
Else
CountBlanksCells = 0
End If
On Error GoTo 0
End Function

"Helmut" wrote:

Hi DomThePom,
Great BUT it prints not only the rows with the BLANK CELL but it prints the
whole worksheet. I only want to print the rows with the blank cells.
thanks
Helmut

"DomThePom" wrote:

Here you go Helmut:

Sub PrintAndExitIfBlankEmplyeeData()

Dim rng As Range
Set rng = Range("Employees")
If rng.SpecialCells(xlCellTypeBlanks).Cells.Count < 0 Then
Range("Employees").Resize(, 2).PrintOut
Application.DisplayAlerts = False
Application.Quit
End If

End Sub

"Helmut" wrote:

Hi,
I have a RANGE "Employees" with some missing info:

Column A Columns B Column C
21823059 גדעון לי*א 474
27640374 מיעארי טארק 474
36095008 מורא*י רים 474
15786791 פוקס מיכל blank cell
27820257 הראל שלומציון blank cell
28488567 אר*פרוי*ד רו*ית blank cell

I would like that IF NO blank cells in Range THEN continue MACRO

but IF blank cells in Range THEN "print" value of cells A and B and Exit
both Worksheet and Excel.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default Print rows of missing info

Hi,
I am getting a "compile error" : Sub or Function not defined against:

If CountBlanksCells(rng) < 0 Then

Help please... thanks
Helmut
"DomThePom" wrote:

Ask and ye......

Sub PrintAndExitIfBlankEmplyeeData()
Dim rngRow As Range
Dim rng As Range
Set rng = Range("Employees")
If CountBlanksCells(rng) < 0 Then

'hide complete rows
For Each rngRow In rng.Rows
'exclude first row
If rngRow.row < 1 Then
If CountBlanksCells(rngRow) = 0 Then
rngRow.EntireRow.Hidden = True
End If
End If
Next rngRow
Range("Employees").Resize(, 2).PrintOut
Application.DisplayAlerts = False
Application.Quit
End If

End Sub

Function CountBlanksCells(ByRef rng As Range) As Long
Dim lngCount As Long
On Error Resume Next
lngCount = rng.SpecialCells(xlCellTypeBlanks).Cells.Count
If Err.Number = 0 Then
CountBlanksCells = lngCount
Else
CountBlanksCells = 0
End If
On Error GoTo 0
End Function

"Helmut" wrote:

Hi DomThePom,
Great BUT it prints not only the rows with the BLANK CELL but it prints the
whole worksheet. I only want to print the rows with the blank cells.
thanks
Helmut

"DomThePom" wrote:

Here you go Helmut:

Sub PrintAndExitIfBlankEmplyeeData()

Dim rng As Range
Set rng = Range("Employees")
If rng.SpecialCells(xlCellTypeBlanks).Cells.Count < 0 Then
Range("Employees").Resize(, 2).PrintOut
Application.DisplayAlerts = False
Application.Quit
End If

End Sub

"Helmut" wrote:

Hi,
I have a RANGE "Employees" with some missing info:

Column A Columns B Column C
21823059 גדעון לי*א 474
27640374 מיעארי טארק 474
36095008 מורא*י רים 474
15786791 פוקס מיכל blank cell
27820257 הראל שלומציון blank cell
28488567 אר*פרוי*ד רו*ית blank cell

I would like that IF NO blank cells in Range THEN continue MACRO

but IF blank cells in Range THEN "print" value of cells A and B and Exit
both Worksheet and Excel.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Print rows of missing info

I have just copied exactly what was in the post to a blank module, removed
the ''s and not got any compile errors.

Are you sure that you pasted both the:

Sub PrintAndExitIfBlankEmplyeeData

and the:

Function CountBlanksCells

into your mudule ?

Clearly, if you pasted the sub and not the function then you will get a
compile error!

"Helmut" wrote:

Hi,
I am getting a "compile error" : Sub or Function not defined against:

If CountBlanksCells(rng) < 0 Then

Help please... thanks
Helmut
"DomThePom" wrote:

Ask and ye......

Sub PrintAndExitIfBlankEmplyeeData()
Dim rngRow As Range
Dim rng As Range
Set rng = Range("Employees")
If CountBlanksCells(rng) < 0 Then

'hide complete rows
For Each rngRow In rng.Rows
'exclude first row
If rngRow.row < 1 Then
If CountBlanksCells(rngRow) = 0 Then
rngRow.EntireRow.Hidden = True
End If
End If
Next rngRow
Range("Employees").Resize(, 2).PrintOut
Application.DisplayAlerts = False
Application.Quit
End If

End Sub

Function CountBlanksCells(ByRef rng As Range) As Long
Dim lngCount As Long
On Error Resume Next
lngCount = rng.SpecialCells(xlCellTypeBlanks).Cells.Count
If Err.Number = 0 Then
CountBlanksCells = lngCount
Else
CountBlanksCells = 0
End If
On Error GoTo 0
End Function

"Helmut" wrote:

Hi DomThePom,
Great BUT it prints not only the rows with the BLANK CELL but it prints the
whole worksheet. I only want to print the rows with the blank cells.
thanks
Helmut

"DomThePom" wrote:

Here you go Helmut:

Sub PrintAndExitIfBlankEmplyeeData()

Dim rng As Range
Set rng = Range("Employees")
If rng.SpecialCells(xlCellTypeBlanks).Cells.Count < 0 Then
Range("Employees").Resize(, 2).PrintOut
Application.DisplayAlerts = False
Application.Quit
End If

End Sub

"Helmut" wrote:

Hi,
I have a RANGE "Employees" with some missing info:

Column A Columns B Column C
21823059 גדעון לי*א 474
27640374 מיעארי טארק 474
36095008 מורא*י רים 474
15786791 פוקס מיכל blank cell
27820257 הראל שלומציון blank cell
28488567 אר*פרוי*ד רו*ית blank cell

I would like that IF NO blank cells in Range THEN continue MACRO

but IF blank cells in Range THEN "print" value of cells A and B and Exit
both Worksheet and Excel.

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
Missing info on worksheet BCalaway Excel Worksheet Functions 0 April 27th 09 04:07 PM
Missing info in Formula Tab SOS Excel 2007 Excel Discussion (Misc queries) 6 September 29th 07 04:19 PM
Legend Missing Info Debra Ann Charts and Charting in Excel 0 October 11th 05 03:23 PM
VBA Challenge - Flag Missing Info keepITcool Excel Programming 0 July 21st 04 09:44 PM
VBA Challenge - Flag Missing Info Frank Kabel Excel Programming 0 July 21st 04 08:04 PM


All times are GMT +1. The time now is 11:15 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"