Results 1 to 3 of 3
  1. #1
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Formatting Another Sheet (03)

    How come this particular line of code does not work if the active sheet is sheet1 but does work if the active sheet is sheet2?

    Sheets("Sheet2").Range(Cells(3, 5), Cells(3, 17)).Borders(xlEdgeTop).LineStyle = xlContinuous


    Thanks,
    John

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Formatting Another Sheet (03)

    Because you don't qualify Cells(...), so it refers to the active sheet.

    Sheets("Sheet2").Range(Sheets("Sheet2").Cells(3, 5), Sheets("Sheet2").Cells(3, 17)).Borders(xlEdgeTop).LineStyle = xlContinuous

    or, of course,

    Sheets("Sheet2").Range("E3:Q3").Borders(xlEdgeTop) .LineStyle = xlContinuous

  3. #3
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Formatting Another Sheet (03)

    What can I say.... <img src=/S/groan.gif border=0 alt=groan width=16 height=15>

Posting Permissions

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