Printing

  • Thread starter Thread starter Sherees
  • Start date Start date
S

Sherees

How to set a button in excel to print a specified area, for eg if i click on
a colum (say, A5), i need to print a specified area immediately.. Please help
on this topic
 
you can just name range to be print in macro like here-

Range("Range1").PrintOut

Range("G3:H15").PrintOut

| How to set a button in excel to print a specified area, for eg if i click
on
| a colum (say, A5), i need to print a specified area immediately.. Please
help
| on this topic
| --
| Life isa journey not a destination
 
Thx for ur ans, but cud u pls educate me a little more in macro coz i dont
know anything abt macro.. I will clearly state my qn again
The sheet is a long report for an year which is seperated as week1 up to
week52
each week will be of a range (sayA1:H10) and on the top (say A1 wil be named
Week 1).. I need to print the entire area that is A1:H10 just by clicking the
cell A1(Week 1) in similar way i need to set for all the 52 weeks, just by
clicking on the weeks it should print the respective weekly report. Please
suggest me in simple terms
 
A5 is a cell reference, not a column.

Record yourself setting up a printrange and printing it.

Assign a button to that macro.

There is another method using event code and a double-click on a cell, say
A5, which will print a specified area.


Gord Dibben MS Excel MVP
 
maybe not posible to teach doing macros in this mesage, especlly for
somebody who english is worser than mine. joke.

but like Gord say maybe try record a macro. recodred macros are not always
the best but they get you going. you could even put my macro inside the one
you record. you have to change the range to print in my macro of course to
the one you want.

| Thx for ur ans, but cud u pls educate me a little more in macro coz i dont
| know anything abt macro.. I will clearly state my qn again
| The sheet is a long report for an year which is seperated as week1 up to
| week52
| each week will be of a range (sayA1:H10) and on the top (say A1 wil be
named
| Week 1).. I need to print the entire area that is A1:H10 just by clicking
the
| cell A1(Week 1) in similar way i need to set for all the 52 weeks, just by
| clicking on the weeks it should print the respective weekly report. Please
| suggest me in simple terms
| --
| Life isa journey not a destination
|
|
| "Homey" wrote:
|
| > you can just name range to be print in macro like here-
| >
| > Range("Range1").PrintOut
| >
| > Range("G3:H15").PrintOut
| >
| > | > | How to set a button in excel to print a specified area, for eg if i
click
| > on
| > | a colum (say, A5), i need to print a specified area immediately..
Please
| > help
| > | on this topic
| > | --
| > | Life isa journey not a destination
| >
| > .
| >
 
Will the ranges be different sizes?

Does the top left cell of each range have a name like Week1, Week2 etc.?

Do you have these ranges named already in Insert>Name>Define or just a title
in a cell?



Gord
 
Ranges are equal in size, Yes the top range has name like Week1 ,Week2... Its
just a title in a cell..

Thank u very much
 
Couple of ways to do this.

Event code which is triggered by a double-click on a cell with the
appropriate text in it..............week1 or week52.....not case-sensitive

Option Compare Text
Private Sub Worksheet_BeforeDoubleClick(ByVal _
Target As Range, Cancel As Boolean)
If Left(Target, 4) <> "week" Then GoTo ws_exit
Target.Resize(10, 8).PrintOut
ws_exit:
Cancel = True
End Sub

Right-click on the Sheet tab and "View Code". Copy/paste the code into that
module. Edit the resize(10, 8) to suit..............set now for a 10 row, 8
column range...........A1:H10 for example.

A macro which asks for user input of week number.

Sub print_week()
Dim weeknum As Integer
weeknum = InputBox("Enter a Number from 1 to 52")
With Worksheets(1).UsedRange
Set c = .Find("week" & weeknum, LookIn:=xlValues, lookat:=xlPart)
If Not c Is Nothing Then
FirstAddress = c.Address
c.Resize(10, 8).PrintOut
End If
End With
End Sub

This macro would be placed in a General module in your workbook.

Note.................neither has error-checking.

See Ron de Bruin's site for where and how to store macros and code.

http://www.rondebruin.nl/code.htm


Gord
 
Back
Top