![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Mar 2002
Posts: 1,288
|
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, .Interior.ColorIndex = 2 End With End If |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
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 | |
|
Board Regular
Join Date: Mar 2002
Posts: 1,288
|
Quote:
I receive still a syntaxis-error at that line afther add the continuation _ Have you any idea about this? Thanks. |
|
|
|
|
|
|
#4 |
|
Banned
Join Date: Feb 2002
Posts: 1,582
|
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 | |
|
Board Regular
Join Date: Mar 2002
Posts: 1,288
|
Quote:
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 |
|
Banned
Join Date: Feb 2002
Posts: 1,582
|
Try this, I think it's what you want.
Code:
Range(Cells(x, 3), Cells(x, 256).End(xlToLeft)).Interior.ColorIndex = 6 |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|