Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Printout Code Problem

Hi,

How to modify the code down below, to prinout the numbers at one sheet

Not as now on several sheets, as the conditions are tested down to ro
206.

Sub HideRows()
Dim i As Long
For i = 5 To 206
Rows(i).EntireRow.Hidden = Range("BQ" & i).Value = 0
Next i
Range("A1").Select
ActiveSheet.PrintOut
End Su

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Printout Code Problem

If you mean a specific sheet:
Sub HideRows()
Dim i As Long
With worksheets("Sheet1")
For i = 5 To 206
.Rows(i).EntireRow.Hidden = _
.Range("BQ" & i).Value = 0
Next i
.PrintOut
End With
End Sub

if you mean make the 206 dynamic

Sub HideRows()
Dim i As Long, lastRow as long
lastRow = cells(rows.count,"A").end(xlup).row
For i = 5 To lastRow
Rows(i).EntireRow.Hidden = Range("BQ" & i).Value = 0
Next i
Range("A1").Select
ActiveSheet.PrintOut
End Sub

Change the "A" to indicate the column to test to find the last row


--
Regards,
Tom Ogilvy


"Jonsson " wrote in message
...
Hi,

How to modify the code down below, to prinout the numbers at one sheet.

Not as now on several sheets, as the conditions are tested down to row
206.

Sub HideRows()
Dim i As Long
For i = 5 To 206
Rows(i).EntireRow.Hidden = Range("BQ" & i).Value = 0
Next i
Range("A1").Select
ActiveSheet.PrintOut
End Sub


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Printout Code Problem

Hi Tom,

Your code didŽnt solve my problem.

This is what I want to do:

Instead of printing all of the pages from the sheet,(9 pages), I wan
to "compress" the rows to be print outed on one page, as I have hidde
the unwanted rows.

Sorry for my bad english!!
Hope you can understand me anyway!!

//Thoma

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Printout Code Problem

Sub PrintRows()
Dim i As Long, rw as Long
Dim sh as Worksheet
Dim sh1 as Worksheet
Dim wkbk as Workbook
set wkbk = Activeworkbook
workbooks.Add
set sh1 = ActiveSheet
rw = 1
for each sh in wkbk.worksheets
For i = 5 To 206
if sh.Range("BQ" & i).Value < 0 then
sh.Rows(i).EntireRow.copy Destination:=sh1.Cells(rw,1)
rw = rw + 1
End if
Next i
Next sh
Sh1.PrintOut
sh1.parent.close Savechanges:=False
End Sub

--
Regards,
Tom Ogilvy



"Jonsson " wrote in message
...
Hi Tom,

Your code didŽnt solve my problem.

This is what I want to do:

Instead of printing all of the pages from the sheet,(9 pages), I want
to "compress" the rows to be print outed on one page, as I have hidden
the unwanted rows.

Sorry for my bad english!!
Hope you can understand me anyway!!

//Thomas


---
Message posted from http://www.ExcelForum.com/



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Printout Code Problem

Hi Tom,

I ran into new problems when using your new code.
As I have lookup functions and several others of links and formulas, i
wont work to use a new workbook.

See attached file example, and you will understand what I mean.

IŽm really grateful for your struggle to help me!!

//Thoma

--
Message posted from http://www.ExcelForum.com



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Printout Code Problem

Sub PrintRows()
Dim i As Long, rw as Long
Dim sh as Worksheet
Dim sh1 as Worksheet
Dim wkbk as Workbook
set wkbk = Activeworkbook
workbooks.Add
set sh1 = ActiveSheet
rw = 1
for each sh in wkbk.worksheets
For i = 5 To 206
if sh.Range("BQ" & i).Value < 0 then
sh.Rows(i).EntireRow.copy
sh1.Cells(rw,1).PasteSpecial xlvalues
sh1.Cells(rw,1).PasteSpecial xlFormats
rw = rw + 1
End if
Next i
Next sh
Sh1.PrintOut
sh1.parent.close Savechanges:=False
End Sub

--
Regards,
Tom Ogilvy


"Jonsson " wrote in message
...
Hi Tom,

I ran into new problems when using your new code.
As I have lookup functions and several others of links and formulas, it
wont work to use a new workbook.

See attached file example, and you will understand what I mean.

IŽm really grateful for your struggle to help me!!

//Thomas


---
Message posted from http://www.ExcelForum.com/



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Printout Code Problem

Hi Tom,

Is the only way to solve this problem using a new wbk?
IŽd really appreciate if you could come up with a solution that
work in the mainwbk.

Thanks in advance!!

//Thoma

--
Message posted from http://www.ExcelForum.com

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Printout Code Problem

You can add a sheet to the existing workbook instead, but then you would
have to exclude your code from trying to copy from that sheet.

--
Regards,
Tom Ogilvy

"Jonsson " wrote in message
...
Hi Tom,

Is the only way to solve this problem using a new wbk?
IŽd really appreciate if you could come up with a solution that
work in the mainwbk.

Thanks in advance!!

//Thomas


---
Message posted from http://www.ExcelForum.com/



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Printout Code Problem

Hi Tom,

As I have a timeformat that is controlled from a VBA-code in the mai
sheet, and that code will be missing in the new sheet I get the wron
format and only zeros.

Thanks for all your help, I really apprecciate it, but IŽll have t
think of another solution.

//Thomas

P.S

I have found it!

If I choose Archive-Printarea and select my wanted area, then I get al
values on the same sheet!!

Many thanks!!

//Thoma

--
Message posted from http://www.ExcelForum.com

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
Printout using MFC Sachin Excel Worksheet Functions 0 August 4th 08 11:25 AM
no #VALUE! to printout garyww Excel Worksheet Functions 2 August 15th 06 04:19 PM
no #VALUE! to printout garyww Excel Worksheet Functions 1 August 15th 06 10:15 AM
ActiveSheet.PrintOut - problem Derek T. Excel Programming 3 February 23rd 04 07:36 PM
PRINTOUT Wayne Blosat Excel Programming 0 August 27th 03 09:07 PM


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

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"