Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a Macro that dependent on a value in a cell of the worksheet,
SHOULD perform, but it isn't. Based upon the value of cell H2, I need the macro to treat the data manipulation in my code differently. The cutoff is 1. If the cell value is one I need to treat the data one way, and any integer greater than 1 needs to be treated differently. If the value is greater than one, I have a For Each loop running which serves as a counter for a dynamic array of integers. Whenever I run the macro, and I get to the case of values Greater than 1, the initial counter works (Values of 1 for the counter, not the cell the case is evaluated). However, it never executes the second, third...nth iteration of the values in the array. It just ends I do know that the code for the actual manipulation works, as I have run each of them in independent modules, and it performs as expected. I have tried both "If Then Else" and "Select Case" and both loops give me the same problem. Below is the code, with the actual manipulation removed as I know it works. I have put a breakpoint in the code, and stepped through it with the Locals Window open, and the counter never advances past 1 for my second case, although it should. Select Case Sheets("Sheet1").Range("H2").Value Case Is = 1 Sheets.Add.Name = "F" & single_carrier ......More Code Here Case Is 1 For Each carrier In Sheets("Sheet1").Range("D2:D" & carrier_array_upper) 'THIS IS WHERE THE COUNTER INITS AND SHOULD ITERATE Sheets.Add.Name = "F" & carrier Next carrier End Select |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Case without Select Case error problem | Excel Discussion (Misc queries) | |||
Select case and Last Cell Problem | Excel Programming | |||
Problem with Select Case construct? | Excel Programming | |||
Select Case on a range - problem | Excel Programming | |||
Problem With Select Case | Excel Programming |