View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Flanagan Bob Flanagan is offline
external usenet poster
 
Posts: 340
Default Print macro for Excel 2003.

The following should get you started:

Dim N
Dim cell As Range
N = Application.InputBox("Enter a value")
If TypeName(N) = "Boolean" Then Exit Sub
Columns("D:D").Select
Set cell = Columns("d:d").Find(What:=N, LookIn:=xlValues, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False)
If cell Is Nothing Then
MsgBox "No value found"
Else
ActiveSheet.PageSetup.PrintArea = Range(Range("a1"), cell).Address
End If

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

"Johan" wrote in message
...
Hi,

I would like to create a macro that print my excel
worksheet from row 1 to a value in a certain cell. How do
I do that?

/Johan