Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default Can a macro do this job?

I have a range a1:c20 ,the values of this range are based on datavalidation
list in a1.
select first value from datavalidation list ,display and print values of
range a1:c20(first page),then select second value from the datavalidation
list,display and print values of range a1:c20(second page) ,loop and do the
job until the end of datavalidaton list.
Can a macro do this job?

--
Message posted via http://www.officekb.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Can a macro do this job?

Option Explicit
Sub Testme()

Dim myValidRng as range
dim myCell as range


'change this to point to the range that holds the list that's used
'for validation
set myValidRng = worksheets("Sheet9999").range("myList")

with worksheets("Sheet1")
for each mycell in myValidRng.cells
.range("a1").value = mycell.value
.calculate 'just in case
.printout preview:=true
next mycell
end with
end sub

If you only wanted to print A1:C20:
.range("a1:c20").printout


(Untested, uncompiled. Watch out for typos.)


"tkraju via OfficeKB.com" wrote:

I have a range a1:c20 ,the values of this range are based on datavalidation
list in a1.
select first value from datavalidation list ,display and print values of
range a1:c20(first page),then select second value from the datavalidation
list,display and print values of range a1:c20(second page) ,loop and do the
job until the end of datavalidaton list.
Can a macro do this job?

--
Message posted via http://www.officekb.com


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default Can a macro do this job?

Thank you Dave,Its fantastic.

Dave Peterson wrote:
Option Explicit
Sub Testme()

Dim myValidRng as range
dim myCell as range

'change this to point to the range that holds the list that's used
'for validation
set myValidRng = worksheets("Sheet9999").range("myList")

with worksheets("Sheet1")
for each mycell in myValidRng.cells
.range("a1").value = mycell.value
.calculate 'just in case
.printout preview:=true
next mycell
end with
end sub

If you only wanted to print A1:C20:
.range("a1:c20").printout

(Untested, uncompiled. Watch out for typos.)


I have a range a1:c20 ,the values of this range are based on datavalidation
list in a1.

[quoted text clipped - 6 lines]
--
Message posted via http://www.officekb.com



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200905/1

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
AutoRun Macro with a delay to give user the choice to cancel the macro wanderlust Excel Programming 2 September 28th 07 04:09 PM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
Macro not showing in Tools/Macro/Macros yet show up when I goto VBA editor [email protected] Excel Programming 2 March 30th 07 07:48 PM
how to count/sum by function/macro to get the number of record to do copy/paste in macro tango Excel Programming 1 October 15th 04 01:16 PM
Start Macro / Stop Macro / Restart Macro Pete[_13_] Excel Programming 2 November 21st 03 05:04 PM


All times are GMT +1. The time now is 12:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"