close

Hi
All i want to do is press a form button and print out a cell range, there
are multiple buttons on the spreadsheet each on to print a different range of
cells on same sheet i used this quot;ActiveSheet.PrintOut.PageSetup.PrintArea =
quot;A8:B8quot; to try and doi it changing the print area but it keeps saying there
is an error, any ideas anybody please, or is there another way to do it
--
thanks
Mike

Mike

try:

With ActiveSheet
.PageSetup.PrintArea = quot;A8:B8quot;
.PrintPreview
' .PrintOut
End With

Regards

Trevorquot;Mikequot; gt; wrote in message
...
gt; Hi
gt; All i want to do is press a form button and print out a cell range, there
gt; are multiple buttons on the spreadsheet each on to print a different range
gt; of
gt; cells on same sheet i used this quot;ActiveSheet.PrintOut.PageSetup.PrintArea
gt; =
gt; quot;A8:B8quot; to try and doi it changing the print area but it keeps saying
gt; there
gt; is an error, any ideas anybody please, or is there another way to do it
gt; --
gt; thanks
gt; Mike
You could use something like:

With ActiveSheet
.PageSetup.PrintArea = quot;a8:b8quot;
.PrintOut preview:=True
End With

Or maybe without changing the printrange...

ActiveSheet.Range(quot;a8:b8quot;).PrintOut preview:=True

Mike wrote:
gt;
gt; Hi
gt; All i want to do is press a form button and print out a cell range, there
gt; are multiple buttons on the spreadsheet each on to print a different range of
gt; cells on same sheet i used this quot;ActiveSheet.PrintOut.PageSetup.PrintArea =
gt; quot;A8:B8quot; to try and doi it changing the print area but it keeps saying there
gt; is an error, any ideas anybody please, or is there another way to do it
gt; --
gt; thanks
gt; Mike

--

Dave Peterson

Try:
ActiveSheet.PageSetup.PrintArea = quot;$A$1:$B$8quot;
--
Gary''s Studentquot;Mikequot; wrote:

gt; Hi
gt; All i want to do is press a form button and print out a cell range, there
gt; are multiple buttons on the spreadsheet each on to print a different range of
gt; cells on same sheet i used this quot;ActiveSheet.PrintOut.PageSetup.PrintArea =
gt; quot;A8:B8quot; to try and doi it changing the print area but it keeps saying there
gt; is an error, any ideas anybody please, or is there another way to do it
gt; --
gt; thanks
gt; Mike

Thanks Dave
That works brilliantly, is there a way to record how many times the button
is pressed as well please
--
thanksquot;Dave Petersonquot; wrote:

gt; You could use something like:
gt;
gt; With ActiveSheet
gt; .PageSetup.PrintArea = quot;a8:b8quot;
gt; .PrintOut preview:=True
gt; End With
gt;
gt; Or maybe without changing the printrange...
gt;
gt; ActiveSheet.Range(quot;a8:b8quot;).PrintOut preview:=True
gt;
gt; Mike wrote:
gt; gt;
gt; gt; Hi
gt; gt; All i want to do is press a form button and print out a cell range, there
gt; gt; are multiple buttons on the spreadsheet each on to print a different range of
gt; gt; cells on same sheet i used this quot;ActiveSheet.PrintOut.PageSetup.PrintArea =
gt; gt; quot;A8:B8quot; to try and doi it changing the print area but it keeps saying there
gt; gt; is an error, any ideas anybody please, or is there another way to do it
gt; gt; --
gt; gt; thanks
gt; gt; Mike
gt;
gt; --
gt;
gt; Dave Peterson
gt;

Keep in mind that the cell reference A8:b8 will not change (in your code
module) if in the excel sheet (interface) quot;someonequot; moves your range or
inserts a row or column; Giving A8:B8 a name would improve such things.

HTH

quot;Dave Petersonquot; gt; wrote in message
...
gt; You could use something like:
gt;
gt; With ActiveSheet
gt; .PageSetup.PrintArea = quot;a8:b8quot;
gt; .PrintOut preview:=True
gt; End With
gt;
gt; Or maybe without changing the printrange...
gt;
gt; ActiveSheet.Range(quot;a8:b8quot;).PrintOut preview:=True
gt;
gt; Mike wrote:
gt;gt;
gt;gt; Hi
gt;gt; All i want to do is press a form button and print out a cell range, there
gt;gt; are multiple buttons on the spreadsheet each on to print a different
gt;gt; range of
gt;gt; cells on same sheet i used this
gt;gt; quot;ActiveSheet.PrintOut.PageSetup.PrintArea =
gt;gt; quot;A8:B8quot; to try and doi it changing the print area but it keeps saying
gt;gt; there
gt;gt; is an error, any ideas anybody please, or is there another way to do it
gt;gt; --
gt;gt; thanks
gt;gt; Mike
gt;
gt; --
gt;
gt; Dave Peterson
You could use a cell in a worksheet (that's hidden).

ActiveSheet.Range(quot;a8:b8quot;).PrintOut preview:=True
with worksheets(quot;hiddennameherequot;).range(quot;a1quot;)
if isnumeric(.value) then
.value = .value 1
else
.value = 1
end if
end with

But if you use this kind of thing, then you have to save the workbook -- so that
the counter gets saved for the next time.

And it's not always a good thing to just save a workbook without knowing the
other changes that have been made. Is there a real reason to care?

Mike wrote:
gt;
gt; Thanks Dave
gt; That works brilliantly, is there a way to record how many times the button
gt; is pressed as well please
gt; --
gt; thanks
gt;
gt; quot;Dave Petersonquot; wrote:
gt;
gt; gt; You could use something like:
gt; gt;
gt; gt; With ActiveSheet
gt; gt; .PageSetup.PrintArea = quot;a8:b8quot;
gt; gt; .PrintOut preview:=True
gt; gt; End With
gt; gt;
gt; gt; Or maybe without changing the printrange...
gt; gt;
gt; gt; ActiveSheet.Range(quot;a8:b8quot;).PrintOut preview:=True
gt; gt;
gt; gt; Mike wrote:
gt; gt; gt;
gt; gt; gt; Hi
gt; gt; gt; All i want to do is press a form button and print out a cell range, there
gt; gt; gt; are multiple buttons on the spreadsheet each on to print a different range of
gt; gt; gt; cells on same sheet i used this quot;ActiveSheet.PrintOut.PageSetup.PrintArea =
gt; gt; gt; quot;A8:B8quot; to try and doi it changing the print area but it keeps saying there
gt; gt; gt; is an error, any ideas anybody please, or is there another way to do it
gt; gt; gt; --
gt; gt; gt; thanks
gt; gt; gt; Mike
gt; gt;
gt; gt; --
gt; gt;
gt; gt; Dave Peterson
gt; gt;

--

Dave Peterson

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()