Re: $$Excel-Macros$$ Table data fit the page size..(auto)
Put this in your sheet module. If you select the range it will be small so I think you only want columns?? Private Sub Worksheet_Activate() 'Range("A1:g41").Select Columns("a:g").Select Application.ActiveWindow.Zoom = True Range("a1").Select End Sub Don Guillett Microsoft MVP Excel SalesAid Software dguille...@gmail.com From: Mohammed Muneer Sent: Tuesday, May 08, 2012 1:01 AM To: excel-macros@googlegroups.com Subject: $$Excel-Macros$$ Table data fit the page size..(auto) Dear friends, I want the Table margin fit the page size – by equally grow to all the four sides irrespective of the data consistency. Regards, Muneer, CC… -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. -- To post to this group, send email to excel-macros@googlegroups.com -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. -- To post to this group, send email to excel-macros@googlegroups.com
RE: $$Excel-Macros$$ Table data fit the page size..(auto)
I see you already have it fit to page when printed - Do you mean you want to have the table forced into the shape of the page to completely fill the page? If so, I think you will need a macro, and it could be a bit tricky. You currently have a macro adjusting the margins in the Worksheet.SelectionChange event -- that will slow your worksheet down -- there is no need to reset the margins every time the cursor moves. It should be enough to just set them once in the Page Setup dialog, but if you want to reset them with a macro, use Worksheet.Activate or Workbook.BeforePrint (in Workbook.BeforePrint you might check if the worksheet is in ActiveWindow.SelectedSheets to determine if it is one being printed -- if needed -- it should be reliable in most cases). To resize the table, I would use the Page Setup oftion to Fit to 1 Page TALL, and leave the Fit to pages wide blank. This will only scale the table automatically to fit based on length, and take up as many pages wide as required. Then in your macro adjust the column widths to makke it fit on the one page. I am not experienced with this, so I will leave the details for you or others, unless I find the time to experiment with it. Asa From: excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com] On Behalf Of Mohammed Muneer Sent: Monday, May 07, 2012 11:02 PM To: excel-macros@googlegroups.com Subject: $$Excel-Macros$$ Table data fit the page size..(auto) Dear friends, I want the Table margin fit the page size - by equally grow to all the four sides irrespective of the data consistency. Regards, Muneer, CC. -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. -- To post to this group, send email to excel-macros@googlegroups.com -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. -- To post to this group, send email to excel-macros@googlegroups.com
RE: $$Excel-Macros$$ Table data fit the page size..(auto)
Ya, but it doesn't zoom to the margin, and fit all the four sides. Regards, Muneer, CC I see you already have it fit to page when printed - Do you mean you want to have the table forced into the shape of the page to completely fill the page? If so, I think you will need a macro, and it could be a bit tricky. You currently have a macro adjusting the margins in the Worksheet.SelectionChange event -- that will slow your worksheet down -- there is no need to reset the margins every time the cursor moves. It should be enough to just set them once in the Page Setup dialog, but if you want to reset them with a macro, use Worksheet.Activate or Workbook.BeforePrint (in Workbook.BeforePrint you might check if the worksheet is in ActiveWindow.SelectedSheets to determine if it is one being printed -- if needed -- it should be reliable in most cases). To resize the table, I would use the Page Setup oftion to Fit to 1 Page TALL, and leave the Fit to pages wide blank. This will only scale the table automatically to fit based on length, and take up as many pages wide as required. Then in your macro adjust the column widths to makke it fit on the one page. I am not experienced with this, so I will leave the details for you or others, unless I find the time to experiment with it. Asa From: excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com] On Behalf Of Mohammed Muneer Sent: Monday, May 07, 2012 11:02 PM To: excel-macros@googlegroups.com Subject: $$Excel-Macros$$ Table data fit the page size..(auto) Dear friends, I want the Table margin fit the page size - by equally grow to all the four sides irrespective of the data consistency. Regards, Muneer, CC... -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. -- To post to this group, send email to excel-macros@googlegroups.com -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. -- To post to this group, send email to excel-macros@googlegroups.com -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. -- To post to this group, send email to excel-macros@googlegroups.com
Re: $$Excel-Macros$$ Table data fit the page size..(auto)
Hi, Try below codes, Private Sub Worksheet_SelectionChange(ByVal Target As Range) Application.ScreenUpdating = False With Worksheets(1).PageSetup .LeftMargin = Application.InchesToPoints(0.05) .RightMargin = Application.InchesToPoints(0.05) .TopMargin = Application.InchesToPoints(0.05) .BottomMargin = Application.InchesToPoints(0.05) .HeaderMargin = Application.InchesToPoints(0.05) .FooterMargin = Application.InchesToPoints(0.05) *.Zoom = 150* *.CenterHorizontally = True* End With Application.ScreenUpdating = True End Sub On Tue, May 8, 2012 at 9:32 PM, Mohammed Muneer wrote: > Ya, but it doesn’t zoom to the margin, and fit all the four sides. > > ** ** > > ** ** > > Regards, > > Muneer, > > CC…. > > ** ** > > ** ** > > ** ** > > ** ** > > I see you already have it fit to page when printed - > > ** ** > > Do you mean you want to have the table forced into the shape of the page > to completely fill the page? > > ** ** > > If so, I think you will need a macro, and it could be a bit tricky. > > ** ** > > You currently have a macro adjusting the margins in the > Worksheet.SelectionChange event -- that will slow your worksheet down -- > there is no need to reset the margins every time the cursor moves. It > should be enough to just set them once in the Page Setup dialog, but if you > want to reset them with a macro, use Worksheet.Activate or > Workbook.BeforePrint (in Workbook.BeforePrint you might check if the > worksheet is in ActiveWindow.SelectedSheets to determine if it is one being > printed -- if needed -- it should be reliable in most cases). > > ** ** > > To resize the table, I would use the Page Setup oftion to Fit to 1 Page > TALL, and leave the Fit to pages wide blank. This will only scale the > table automatically to fit based on length, and take up as many pages wide > as required. Then in your macro adjust the column widths to makke it fit > on the one page. I am not experienced with this, so I will leave the > details for you or others, unless I find the time to experiment with it.** > ** > > ** ** > > Asa > > ** ** > > ** ** > > *From:* excel-macros@googlegroups.com [mailto: > excel-macros@googlegroups.com] *On Behalf Of *Mohammed Muneer > *Sent:* Monday, May 07, 2012 11:02 PM > *To:* excel-macros@googlegroups.com > *Subject:* $$Excel-Macros$$ Table data fit the page size..(auto) > > ** ** > > Dear friends, > > ** ** > > I want the Table margin fit the page size – by equally grow to all the > four sides irrespective of the data consistency. > > ** ** > > ** ** > > ** ** > > Regards, > > Muneer, > > CC… > > -- > FORUM RULES (986+ members already BANNED for violation) > > 1) Use concise, accurate thread titles. Poor thread titles, like Please > Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice > will not get quick attention or may not be answered. > > 2) Don't post a question in the thread of another member. > > 3) Don't post questions regarding breaking or bypassing any security > measure. > > 4) Acknowledge the responses you receive, good or bad. > > 5) Cross-promotion of, or links to, forums competitive to this forum in > signatures are prohibited. > > NOTE : Don't ever post personal or confidential data in a workbook. Forum > owners and members are not responsible for any loss. > > > -- > To post to this group, send email to excel-macros@googlegroups.com > > -- > FORUM RULES (986+ members already BANNED for violation) > > 1) Use concise, accurate thread titles. Poor thread titles, like Please > Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice > will not get quick attention or may not be answered. > > 2) Don't post a question in the thread of another member. > > 3) Don't post questions regarding breaking or bypassing any security > measure. > > 4) Acknowledge the responses you receive, good or bad. > > 5) Cross-promotion of, or links to, forums competitive to this forum in > signatures are prohibited. > > NOTE : Don't ever post personal or confidential data in a workbook. Forum > owners and members are not responsible for any loss. > > > -- > To post to this group, send email to excel-macros@googlegroups.com > > -- > FORUM RULES (986+ members already BANNED for violation) > > 1) Use concise, accurate thread titles. Poor thread titles, like Please > Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice > will not get quick attention or may not be answered. > > 2) Don't post a question in the thread of another member. > > 3) Don't post questions regarding breaking or bypassing any security > measure. > > 4) Acknowledge the responses you receive, good or bad. > > 5) Cross-promotion of, or links to, forums competitive to this
Re: $$Excel-Macros$$ Table data fit the page size..(auto)
Are you talking about fitting when viewing or printing. Don Guillett Microsoft MVP Excel SalesAid Software dguille...@gmail.com From: Mohammed Muneer Sent: Tuesday, May 08, 2012 11:32 PM To: excel-macros@googlegroups.com Subject: RE: $$Excel-Macros$$ Table data fit the page size..(auto) Ya, but it doesn’t zoom to the margin, and fit all the four sides. Regards, Muneer, CC…. I see you already have it fit to page when printed - Do you mean you want to have the table forced into the shape of the page to completely fill the page? If so, I think you will need a macro, and it could be a bit tricky. You currently have a macro adjusting the margins in the Worksheet.SelectionChange event -- that will slow your worksheet down -- there is no need to reset the margins every time the cursor moves. It should be enough to just set them once in the Page Setup dialog, but if you want to reset them with a macro, use Worksheet.Activate or Workbook.BeforePrint (in Workbook.BeforePrint you might check if the worksheet is in ActiveWindow.SelectedSheets to determine if it is one being printed -- if needed -- it should be reliable in most cases). To resize the table, I would use the Page Setup oftion to Fit to 1 Page TALL, and leave the Fit to pages wide blank. This will only scale the table automatically to fit based on length, and take up as many pages wide as required. Then in your macro adjust the column widths to makke it fit on the one page. I am not experienced with this, so I will leave the details for you or others, unless I find the time to experiment with it. Asa From: excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com] On Behalf Of Mohammed Muneer Sent: Monday, May 07, 2012 11:02 PM To: excel-macros@googlegroups.com Subject: $$Excel-Macros$$ Table data fit the page size..(auto) Dear friends, I want the Table margin fit the page size – by equally grow to all the four sides irrespective of the data consistency. Regards, Muneer, CC… -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. -- To post to this group, send email to excel-macros@googlegroups.com -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. -- To post to this group, send email to excel-macros@googlegroups.com -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. -- To post to this group, send email to excel-macros@googlegroups.com -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a questi
RE: $$Excel-Macros$$ Table data fit the page size..(auto)
Ya, u r right. Regards, Muneer, CC. Are you talking about fitting when viewing or printing. Don Guillett Microsoft MVP Excel SalesAid Software dguille...@gmail.com From: Mohammed Muneer <mailto:mmun...@ccc.com.qa> Sent: Tuesday, May 08, 2012 11:32 PM To: excel-macros@googlegroups.com Subject: RE: $$Excel-Macros$$ Table data fit the page size..(auto) Ya, but it doesn't zoom to the margin, and fit all the four sides. Regards, Muneer, CC I see you already have it fit to page when printed - Do you mean you want to have the table forced into the shape of the page to completely fill the page? If so, I think you will need a macro, and it could be a bit tricky. You currently have a macro adjusting the margins in the Worksheet.SelectionChange event -- that will slow your worksheet down -- there is no need to reset the margins every time the cursor moves. It should be enough to just set them once in the Page Setup dialog, but if you want to reset them with a macro, use Worksheet.Activate or Workbook.BeforePrint (in Workbook.BeforePrint you might check if the worksheet is in ActiveWindow.SelectedSheets to determine if it is one being printed -- if needed -- it should be reliable in most cases). To resize the table, I would use the Page Setup oftion to Fit to 1 Page TALL, and leave the Fit to pages wide blank. This will only scale the table automatically to fit based on length, and take up as many pages wide as required. Then in your macro adjust the column widths to makke it fit on the one page. I am not experienced with this, so I will leave the details for you or others, unless I find the time to experiment with it. Asa From: excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com] On Behalf Of Mohammed Muneer Sent: Monday, May 07, 2012 11:02 PM To: excel-macros@googlegroups.com Subject: $$Excel-Macros$$ Table data fit the page size..(auto) Dear friends, I want the Table margin fit the page size - by equally grow to all the four sides irrespective of the data consistency. Regards, Muneer, CC... -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. -- To post to this group, send email to excel-macros@googlegroups.com -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. -- To post to this group, send email to excel-macros@googlegroups.com -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. -- To post to this group, send email to excel-macros@googlegroups.com -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, an
Re: $$Excel-Macros$$ Table data fit the page size..(auto)
WHICH??? Don Guillett Microsoft MVP Excel SalesAid Software dguille...@gmail.com From: Mohammed Muneer Sent: Wednesday, May 09, 2012 8:52 AM To: excel-macros@googlegroups.com Subject: RE: $$Excel-Macros$$ Table data fit the page size..(auto) Ya, u r right. Regards, Muneer, CC….. Are you talking about fitting when viewing or printing. Don Guillett Microsoft MVP Excel SalesAid Software dguille...@gmail.com From: Mohammed Muneer Sent: Tuesday, May 08, 2012 11:32 PM To: excel-macros@googlegroups.com Subject: RE: $$Excel-Macros$$ Table data fit the page size..(auto) Ya, but it doesn’t zoom to the margin, and fit all the four sides. Regards, Muneer, CC…. I see you already have it fit to page when printed - Do you mean you want to have the table forced into the shape of the page to completely fill the page? If so, I think you will need a macro, and it could be a bit tricky. You currently have a macro adjusting the margins in the Worksheet.SelectionChange event -- that will slow your worksheet down -- there is no need to reset the margins every time the cursor moves. It should be enough to just set them once in the Page Setup dialog, but if you want to reset them with a macro, use Worksheet.Activate or Workbook.BeforePrint (in Workbook.BeforePrint you might check if the worksheet is in ActiveWindow.SelectedSheets to determine if it is one being printed -- if needed -- it should be reliable in most cases). To resize the table, I would use the Page Setup oftion to Fit to 1 Page TALL, and leave the Fit to pages wide blank. This will only scale the table automatically to fit based on length, and take up as many pages wide as required. Then in your macro adjust the column widths to makke it fit on the one page. I am not experienced with this, so I will leave the details for you or others, unless I find the time to experiment with it. Asa From: excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com] On Behalf Of Mohammed Muneer Sent: Monday, May 07, 2012 11:02 PM To: excel-macros@googlegroups.com Subject: $$Excel-Macros$$ Table data fit the page size..(auto) Dear friends, I want the Table margin fit the page size – by equally grow to all the four sides irrespective of the data consistency. Regards, Muneer, CC… -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. -- To post to this group, send email to excel-macros@googlegroups.com -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. -- To post to this group, send email to excel-macros@googlegroups.com -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. -- To post to this group, send email to e