Thanks for feeding back - I'm glad it worked for you.
Pete
FennisDuck wrote:
[Quoted Text] > thank you very much the formula worked spot on > the aim was to dump pages = to members records so I changed the start range > to A2 in all ranges and it dumps the required amount of pages > > once again thank you > > > > You have got the symbols for greater than and equals the wrong way > round. Also, I would suggest you use ElseIf, as follows: > > If ZZ >= 1 And ZZ <=7 Then > ActiveSheet.Range("A2:G36").PrintOut > ElseIf ZZ > 7 And ZZ <=14 Then > ActiveSheet.Range("A2:G71").PrintOut > ElseIf ZZ > 14 And ZZ <=22 Then > ActiveSheet.Range("A72:G106").PrintOut > End If > > Not knowing what values ZZ could take, I have changed some of the > comparisons - if ZZ is 7.5, for example, I assume you would want to > print out the middle range. I think your middle range is meant to be > A37:G71. Note that if ZZ is less than 1 or greater than 22, then you > will not get a printout. > > Hope this helps. > > Pete > > FennisDuck wrote: > > Sorry Pete UK > > It will only print range when zz is between 1 & 7 anything above that > > there > > is no print > > but it is appreciated , thank you > > > > Sub PrintList() > > > > ' PrintList Macro > > > > > > > > Sheets("w002").Select > > > > ZZ = Worksheets("w001").Range("a27").Value ' get value . this is > > variable > > > > > > > > If ZZ => 1 And ZZ <=7 Then ' Only hthis range will > > print when value is 1 to 7 > > > > ActiveSheet.Range("A2:G36").PrintOut > > > > If ZZ => 8 And ZZ < =14 Then > > > > ActiveSheet.Range("A2:G71").PrintOut > > > > If ZZ => 15 And ZZ < =22 Then > > > > ActiveSheet.Range("a72:G106").PrintOut > > > > > > > > End If > > > > End If > > > > End If > > > > > > > > End Sub > > > > > > > > "Pete_UK" <pashurst[ at ]auditel.net> wrote in message > > news:1157977200.204775.214820[ at ]h48g2000cwc.googlegroups.com... > > > You will need to use AND and get the operators in the correct syntax: > > > > > > If zz >=1 And zz <= 7 Then > > > etc > > > > > > which means if zz is between 1 and 7 (inclusive) then do something ... > > > > > > Hope this helps. > > > > > > Pete > > > > > > FennisDuck wrote: > > >> I am using zz as my variable > > >> what I want to do is > > >> if zz is between 7 and 10 then print out a range within a sheet > > >> is the print range line correct ???????? > > >> any assistance appreciated > > >> > > >> If ZZ = >1 or < =7 Then ' check value of zz > > >> Range("A2:G36").PrintOut.SelectedSheets ' Print selected range > > >> > > >> If ZZ > 8 or < 14Then > > >> Range("A2:G36").PrintOut.SelectedSheets > > >
|