![]() |
![]() |
|
|||||||
| 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: Apr 2002
Location: Puerto Vallarta, Mexico
Posts: 869
|
I will start this by saying, I am not a programmer.
I want to create a Loop as follows: For i = 1-500 SelectCaseRange("P1").Value CaseIs = "ERROR" Range(A1:F1).Select With Selection.Interior .ColorIndex = 3 .Pattern = x1Solid EndWith Case Else Range(A1:F1).Select Selection.Interior.ColorIndex = x1None End Selection Next i My question is this: For each pass thru the loop, I want the values P1 and A1 and F1 to increment. ie P2,P3,P4..... and A2:F2, A3:F3.... Is this possible? |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Columbus, OH, USA
Posts: 3,519
|
Yup, there's two main ways you can do this, I'll show you my preferred way because this will work best with the A to F range:
SelectCaseRange("P1").Offset((i-1), 0).Value HTH |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|