Macro
Manage your personal finances in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 6 of 6

Thread: Macro

  1. #1
    Board Regular
    Join Date
    Mar 2002
    Posts
    1,451
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    Why I receive an error at the line:
    ".Interiorcolor.Index = 2" ?
    Can somebody help me?
    Many thanks.
    While Cells(x, 1).Text <> ""
    If Cells(x, 3).Value >= Cells(x, 4).Value Then
    With Cells(x, 3)
    .Interior.ColorIndex = 6
    End With
    Else
    With Cells(x, 3) And Cells(x, 4) And Cells(x, 5) And Cells(x, 6) And Cells(x, 7) And Cells(x, And Cells(x, 9) And Cells(x, 10)
    .Interior.ColorIndex = 2
    End With
    End If

  2. #2
    Board Regular
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    6,824
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi
    Add a continuation _
    after this line:

    And Cells(x, And Cells(x, 9) And Cells(x, 10)

    Should be:

    And Cells(x, And Cells(x, 9) And Cells(x, 10) _

    Good Day!
    Tom

  3. #3
    Board Regular
    Join Date
    Mar 2002
    Posts
    1,451
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-04-03 02:18, TsTom wrote:
    Hi
    Add a continuation _
    after this line:

    And Cells(x, And Cells(x, 9) And Cells(x, 10)

    Should be:

    And Cells(x, And Cells(x, 9) And Cells(x, 10) _

    Good Day!
    Tom
    Tom,

    I receive still a syntaxis-error at that line afther add the continuation _
    Have you any idea about this?
    Thanks.

  4. #4
    Rest in Peace
    Join Date
    Feb 2002
    Posts
    1,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi

    You cannot use the With Statement on more than one Object as you have. Change it to:

    For i = 3 To 10
    Cells(x, i).Interior.ColorIndex = 6
    Next i


    OR

    Range(Cells(x, 3), Cells(x, 10)).Interior.ColorIndex = 6
    _________________
    Kind Regards
    Dave Hawley
    OzGrid Business Applications
    Microsoft Excel/VBA Training


    [ This Message was edited by: Dave Hawley on 2002-04-03 03:19 ]

  5. #5
    Board Regular
    Join Date
    Mar 2002
    Posts
    1,451
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-04-03 03:16, Dave Hawley wrote:
    Hi

    You cannot use the With Statement on more than one Object as you have. Change it to:

    For i = 3 To 10
    Cells(x, i).Interior.ColorIndex = 6
    Next i


    OR

    Range(Cells(x, 3), Cells(x, 10)).Interior.ColorIndex = 6
    _________________
    Kind Regards
    Dave Hawley
    OzGrid Business Applications
    Microsoft Excel/VBA Training


    [ This Message was edited by: Dave Hawley on 2002-04-03 03:19 ]
    Thanks,your last suggestion works fine.
    Can you tell me,is it possible that:Range(Cells(x, 3), Cells(x,10)).Interior.ColorIndex = 6

    Cells(X,10) could be the last empty column otherwise I must change each time the number 10 to 11 or 12 or 13 .....
    Many thanks.

  6. #6
    Rest in Peace
    Join Date
    Feb 2002
    Posts
    1,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    Try this, I think it's what you want.

    Code:
    Range(Cells(x, 3), Cells(x, 256).End(xlToLeft)).Interior.ColorIndex = 6

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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

 

 
DMCA.com