Can a macro do this job?

  • Thread starter tkraju via OfficeKB.com
  • Start date
T

tkraju via OfficeKB.com

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?
 
D

Dave Peterson

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.)
 
T

tkraju via OfficeKB.com

Thank you Dave,Its fantastic.

Dave said:
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]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top