Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a list of sheets in cell A1:-
"Index", "Area 1", "Area 2" I want to create a macro that will print out these sheets, some thin like sheetrange = range("a1") sheets(array(sheetrange)).select selectedsheets.printpreview can someone help me out on this one -- Message posted from http://www.ExcelForum.com |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
With worksheets("Sheet1")
varr = Split(.Range("A1")) End With sheets(varr).Select ActiveWindows.SelectedSheets.PrintPreview Works in xl2000 or later. -- Regards, Tom Ogilvy "ianripping " wrote in message ... I have a list of sheets in cell A1:- "Index", "Area 1", "Area 2" I want to create a macro that will print out these sheets, some thing like sheetrange = range("a1") sheets(array(sheetrange)).select selectedsheets.printpreview can someone help me out on this one? --- Message posted from http://www.ExcelForum.com/ |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I havent tested this, but maybe something like:
Sub testSub() mySheets = Split(Sheets("Sheet1").Range("A1").Value, ",") For i = 0 To UBound(mySheets) mySheets(i) = Replace(mySheets(i), """", "") 'MsgBox mySheets(i) Sheets(mySheets(i)).PrintOut Next i End Sub Change "Sheet1" to whatever sheet you keep your array in - try it ou -- Message posted from http://www.ExcelForum.com |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I left off the second argument for split
With worksheets("Sheet1") varr = Split(.Range("A1"),",") End With sheets(varr).Select ActiveWindows.SelectedSheets.PrintPreview it would be easier to adjust the values in A1 to be Index,Area 1,Area 2 rather than to write code to eliminate the doublequotes. Particularly since you will probably be changing this list frequently. -- Regards, Tom Ogilvy "sp00nix " wrote in message ... I havent tested this, but maybe something like: Sub testSub() mySheets = Split(Sheets("Sheet1").Range("A1").Value, ",") For i = 0 To UBound(mySheets) mySheets(i) = Replace(mySheets(i), """", "") 'MsgBox mySheets(i) Sheets(mySheets(i)).PrintOut Next i End Sub Change "Sheet1" to whatever sheet you keep your array in - try it out --- Message posted from http://www.ExcelForum.com/ |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have tried both of these methods, but the problem is i get acompli
error "Sub or function not defined" for Split. I am running excel 97. Could this be the problem that the Spli function isnt supported? If so, what can I do -- Message posted from http://www.ExcelForum.com |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Works in xl2000 or later.
was in my original post. Split wasn't introduce until Excel 2000. You could do this Sub tester3() With Worksheets("Sheet1") sStr = .Range("A1") End With varr = Evaluate("{" & sStr & "}") Sheets(varr).Select ActiveWindow.SelectedSheets.PrintPreview End Sub This assume you use your original format in the cell with the double quotes: "Index", "Area 1", "Area 2" -- Regards, Tom Ogilvy "ianripping " wrote in message ... I have tried both of these methods, but the problem is i get acomplie error "Sub or function not defined" for Split. I am running excel 97. Could this be the problem that the Split function isnt supported? If so, what can I do? --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Prevent cell/array references from changing when altering/moving thecell/array | Excel Discussion (Misc queries) | |||
cell borders that I create dont show on print preview or print | Excel Discussion (Misc queries) | |||
Print Array for hidden sheets using VBA | Excel Discussion (Misc queries) | |||
Print Array for hidden sheets using VBA | Excel Discussion (Misc queries) | |||
Sheet(Array( Won't print as I expect it to | Excel Worksheet Functions |