Excel Print Routine Help

About six months ago I asked in this ng about a routine to put into Excel to skip any page that didn't have a character of some sort in a specific cell.

Some kind person wrote up a routine for me that started off:

Sub selprint() Dim i As Integer Dim currentsheet As Worksheet

For i = 1 To ActiveWorkbook.Worksheets.Count

I have tried everything I know to insert that routine into Excel and have failed miserably. WOuld that kind person please lead me by the hand through the installation and use stuff?

Many thanks,

Jim

--
"It is the mark of an educated mind to be able to entertain a thought 
without accepting it."
        --Aristotle
Reply to
RST Engineering (jw)
Loading thread data ...

Ask that in 'microsoft.public.excel.worksheet.functions'.

Reply to
Archimedes' Lever

Tools->Macro->Visual basic editor Then you should select ThisWorkbook and past your code

It should work then.

Cheers

>
Reply to
Martin Riddle

I'm sorry, sir, and I appreciate the help, but there is no "ThisWorkbook" command in Tools->Macro->Visual Basic Editor. That was the instruction that somebody gave me last time and I've been on and off fiddling with it for about six months.

Can you be a bit more specific (Excel 2003)?

Jim

Reply to
RST Engineering (jw)

Go into Visual Basic Editor, via the menu as someone said or just press Alt-F11. You'll see This Workbook on left top panel.

Tom

Reply to
Tom

Sorry maybe I was not clear.

To open the VBA Editor, Tools->Macro->Visual basic editor Then in the VBA editor select 'ThisWorkbook' in the Left pane. This applies to Office 2003. As mentioned Alt+F11 is the short cut to the VBA editor.

Cheers

Reply to
Martin Riddle

No, Tom, sorry, that's just not so. Are you using Excel 2003?

Jim

Reply to
RST Engineering (jw)

Martin & Tom

There is no "Left Pane" when I open up the VB editor. THere is a gray screen and two lines of commands along the top. THe top one is the usual "File Edit View ..." and below that there is a toolbar with icons. No Left Pane.

Jim

Reply to
RST Engineering (jw)

In VBA select View->ProjectExplorer. This is the left pane we are referencing. its usually shown by default. It'll Show VBAProject (Book1)... and the list of Sheets(Sheet1 Sheet2....) and ThisWorkbook. Double click on ThisWorkbook and the code window will display.

Cheers

Reply to
Martin Riddle

There's a bunch of icons on the tool bar in the VB editor. One of them says Project Explorer when you slide the cursor onto it. Click that.

I'll send you an Email with an attached screenshot.

Ed

Reply to
ehsjr

FOUND IT. GOT IT. INSTALLED IT.

It doesn't do anything. WHere do we go from here? I used both characters (Y) and numerical characters (1.00) in the target cell and it still printed that page quite nicely. I used null ("") in my IF statement for pages I didn't want to print and it printed THAT page quite nicely as well.

Jim

--

> In VBA select View->ProjectExplorer.  This is the left pane we are 
> referencing.
> its usually shown by default.
> It\'ll Show VBAProject (Book1)... and the list of Sheets(Sheet1 Sheet2....) 
> and ThisWorkbook.
> Double click on ThisWorkbook and the code window will display.
>
> Cheers
>
>
>
Reply to
RST Engineering (jw)

After F11 calls up the VB editor, F7 then calls up the code window and Ctrl-R calls up the Project sidebar.

Cheers, John

Reply to
John KD5YI

Can you post the code?

Cheers

Reply to
Martin Riddle

Do you need his original response reposted?

I think you have to 'run' the routine to perform the calculated print set. You no longer choose print from the menu, you 'call' the routine.

Reply to
Archimedes' Lever

Sure, here you go:

Sub selprint() Dim i As Integer Dim currentsheet As Worksheet

For i = 1 To ActiveWorkbook.Worksheets.Count Set currentsheet = ActiveWorkbook.Worksheets(i) Worksheets(i).Activate 'Skip empty sheets and hidden sheets If Application.CountA(currentsheet.Cells) 0 And currentsheet.Visible Then 'change the hard-coded cell here if not F52 If (Not IsNull(Range("F52"))) And (Range("F52").Value 0) Then 'un-comment the next line when debugging completed ' ActiveSheet.PrintOut 'add comment at start of next line when debugging completed ActiveSheet.PrintPreview End If End If Next i End Sub

Jim

Reply to
RST Engineering (jw)

You know, I was afraid that was going to be the case. If that is true, then all this work is for naught...I'm trying to make this routine work for a bunch of technotards that have trouble finding the "on" switch. Trying to tell them how to call or run a routine is going to be next to impossible.

Jim

Reply to
RST Engineering (jw)

Original post quoted:

Starts getting messier with more tests but taking your example, you coulde modify the line:- "If (Not IsNull(Range("F22"))) And (Range("F22").Value 0) Then" to include an OR function e.g. "If ((Not IsNull(Range("F22"))) And (Range("F22").Value 0)) or ((Not IsNull(Range("G16"))) And (Range("G16").Value 0))Then"

Alternatively could you use another cell on the sheets to flag that F22 OR G16 had a non-zero number? I am not an excel expert so you /could/ get a more structured response from a microsoft excel newsgroup. I also started with GW then QB the VBDOS 1.0 - stopped at VB6 when they went to .NET

Geo

Reply to
Archimedes' Lever

You should be able to make a "button".

Reply to
Archimedes' Lever

The routine was saved as a macro. I made a CTRL-z shortcut to the macro and ran it. Sure enough, it called up the "print preview" menu and I could print the whole workbook out but still, the unwanted pages printed quite nicely. AND, when it was all through printing, I had to close out each page (all 34 of them) one by one. I think I'll go over to an excel group if somebody can recommend one.

Jim

Reply to
RST Engineering (jw)

Same prefix as the other I suggested, but likely this one is more appropriate: m.p.excel.programming

Reply to
Archimedes' Lever

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.