Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Printout using MFC | Excel Worksheet Functions | |||
no #VALUE! to printout | Excel Worksheet Functions | |||
no #VALUE! to printout | Excel Worksheet Functions | |||
ActiveSheet.PrintOut - problem | Excel Programming | |||
PRINTOUT | Excel Programming |