ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   is there a vba way to search for ### in columns before printing (https://www.excelbanter.com/excel-programming/397057-there-vba-way-search-columns-before-printing.html)

Mike Molyneaux

is there a vba way to search for ### in columns before printing
 

Excel 2003, windows xp, sp2.

I need a vba way for users to scan sheets before printing for ### in columns
that need to be extended before printing. They are dysfunctional in looking
at print preview and are wasting time and paper.

Thanks as usual for your outstanding help.

Mike

Tom Ogilvy

is there a vba way to search for ### in columns before printing
 
turn on the macro recorder

select all cells, then do Find and under options tell it to look at values
and uncheck whole words.


I get code like:

Cells.Select
Range("B1").Activate
Selection.Find(What:="###", After:=ActiveCell, LookIn:=xlValues, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False).Activate

you can adapt it to do this
Dim r as Range
do
set r = Cells.Find(What:="###", _
After:=ActiveCell, _
LookIn:=xlValues, LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False, _
SearchFormat:=False)
if r is nothing then exit do
r.EntireColumn.Autofit
Loop

--
Regards,
Tom Ogilvy



"Mike Molyneaux" wrote:


Excel 2003, windows xp, sp2.

I need a vba way for users to scan sheets before printing for ### in columns
that need to be extended before printing. They are dysfunctional in looking
at print preview and are wasting time and paper.

Thanks as usual for your outstanding help.

Mike


Mike Molyneaux

is there a vba way to search for ### in columns before printing
 
Wonderful, thanks again, you guys are fantastic.
--
Mike


"Mike Molyneaux" wrote:


Excel 2003, windows xp, sp2.

I need a vba way for users to scan sheets before printing for ### in columns
that need to be extended before printing. They are dysfunctional in looking
at print preview and are wasting time and paper.

Thanks as usual for your outstanding help.

Mike



All times are GMT +1. The time now is 12:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com