Print row when cell in one column blank
Hi Joel,
Works great...but it is important that EXCEL QUITS at this time because I
have to reload PERSONAL.xlsb before loading any worksheets for other work,
unless we can CLOSE ALL Workbooks EXCEPT PERSONAL.xlsb.
Sorry to be such a nuisance - maybe it's my language. Helmut
"Joel" wrote:
Print Names; where; DEPARTMENT; CODE Is missing & Quit; without; saving
lastrow = Range("A" & Rows.Count).End(xlUp).Row
Set searchrange = Range("C1:C" & lastrow)
blanks = WorksheetFunction.CountBlank(searchrange)
If blanks 0 Then
Columns("C:C").SpecialCells(xlCellTypeBlanks).Enti reRow.Select
Selection.PrintOut
'close thisworkbook last
'close all other books first
For Each bk In Workbooks
If ThisWorkbook.Name < bk.Name Then
bk.Close savechanges:=False
End If
Next bk
ThisWorkbook.Close savechanges:=False
End If
"Helmut" wrote:
Joel,
thanks ok, but this closes: PERSONAL.XLSB and leaves the other two WORKBOOKS
open. I need to QUIT Excel completely without saving the two open workbooks.
thanks
"Joel" wrote:
Try this code
------------------------------------
' Print names where DEPARTMENT CODE is missing & quit without saving
lastrow = Range("A" & Rows.Count).End(xlUp).Row
Set searchrange = Range("C1:C" & lastrow)
blanks = WorksheetFunction.CountBlank(searchrange)
If blanks 0 Then
Columns("C:C").SpecialCells(xlCellTypeBlanks).Enti reRow.Select
Selection.PrintOut
thisworkbook.close savechanges:=False
end if
"Helmut" wrote:
Joel,
it's ok now, I changed :
If blanks = 0 Then Exit Sub
to
If blanks 0 Then Application.quit
But, how can I quit WITHOUT prompt, just quit without saving?
Helmut
"Joel" wrote:
LastRow = Range("A" & Rows.Count).End(xlUp).Row
Set searchrange = Range("C1:C" & LastRow)
blanks = WorksheetFunction.CountBlank(searchrange)
If blanks = 0 Then Exit Sub
"Helmut" wrote:
Joel,
One further step:
If BLANK cells
Columns("C:C").SpecialCells(xlCellTypeBlanks).Enti reRow.Select
Application.quit
If NO BLANK cells
Continue macro
Thanks
"Joel" wrote:
try this easy code
Columns("C:C").SpecialCells(xlCellTypeBlanks).Enti reRow.Select
Selection.PrintOut
"Helmut" wrote:
I have the following:
Column A B C
123456781 name1 473
123456782 name2 471
123456783 name3
123456784 name4 453
123456785 name5
123456786 name6 451
The whole RANGE = "Employees"
Where C = BLANK I would like to PRINT values in A and B and quit application
without saving
|