+ Reply to Thread
Results 1 to 2 of 2

Range is not being picked up

  1. #1
    Registered User
    Join Date
    05-04-2004
    Posts
    15

    Range is not being picked up

    Please take a look at my code, I am trying to pick up the range and print it, depending on the analysis years.

    Dim area As String
    Dim startrow(1) As Integer
    Dim startcol(1) As Integer
    Dim endrow(1) As Integer
    Dim endcol(1) As Integer
    Dim vern_startrow(1) As Integer
    Dim vern_startcol(1) As Integer
    Dim vern_endrow(1) As Integer
    Dim vern_endcol(1) As Integer

    fstyr = Range("FirstAll")
    lstyr = Range("LastAll")

    Sheets("Personal P_L").Select
    For i = 1 To 15
    startrow(1) = 1
    startcol(1) = 20 'T
    endrow(1) = 56 + 2 * (lstyr - fstyr)
    endcol(1) = 46 'AT
    With ActiveSheet.PageSetup
    .Orientation = xlLandscape
    .PaperSize = xlPaperLegal
    .Range(.Cells(startrow, startcol), .Cells(endrow, endcol)).Select
    End With
    Selection.PrintOut Copies:=1, Collate:=True
    Next i

    It gives me an error regarding my Range function...any help???

    Thanks!

  2. #2
    Tom Ogilvy
    Guest

    Re: Range is not being picked up

    .Range(.Cells(startrow(1), startcol(1)), _
    .Cells(endrow(1), endcol(1))).Select


    Not sure what is up with the loop since I don't see anything change inside
    the loop.

    --
    Regards,
    Tom Ogilvy

    "Sheeny" wrote:

    >
    > Please take a look at my code, I am trying to pick up the range and
    > print it, depending on the analysis years.
    >
    > Dim area As String
    > Dim startrow(1) As Integer
    > Dim startcol(1) As Integer
    > Dim endrow(1) As Integer
    > Dim endcol(1) As Integer
    > Dim vern_startrow(1) As Integer
    > Dim vern_startcol(1) As Integer
    > Dim vern_endrow(1) As Integer
    > Dim vern_endcol(1) As Integer
    >
    > fstyr = Range("FirstAll")
    > lstyr = Range("LastAll")
    >
    > Sheets("Personal P_L").Select
    > For i = 1 To 15
    > startrow(1) = 1
    > startcol(1) = 20 'T
    > endrow(1) = 56 + 2 * (lstyr - fstyr)
    > endcol(1) = 46 'AT
    > With ActiveSheet.PageSetup
    > .Orientation = xlLandscape
    > .PaperSize = xlPaperLegal
    > .Range(.Cells(startrow, startcol), .Cells(endrow,
    > endcol)).Select
    > End With
    > Selection.PrintOut Copies:=1, Collate:=True
    > Next i
    >
    > It gives me an error regarding my Range function...any help???
    >
    > Thanks!
    >
    >
    > --
    > Sheeny
    > ------------------------------------------------------------------------
    > Sheeny's Profile: http://www.excelforum.com/member.php...fo&userid=9082
    > View this thread: http://www.excelforum.com/showthread...hreadid=538966
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1