![]() |
Print macro for Excel 2003.
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 |
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 |
All times are GMT +1. The time now is 07:15 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com