D
DavidShepherd
Please help
I am attempting some programming and I am having trouble with the
activecell command within a do loop.
What I am attempting to do is go through a row and have an event occurr
on particular cell values. The problem is that when I attempt to the use
the activecell.value command to trigger the loop to stop excel does not
appear to read the cell value and thus stop the loop. It does not
appear to read the cell value property.
Can you advise me whether I am doing something completely incorrect, or
whether there is another way to have the program read a cell value and
trigger an output.
Here is an example of the code I am using
For a = 1 To n
Application.Goto reference:="project_inclusion_start"
c = 0
Do Until ((ActiveCell.value) ="yes")
e = a + c
ActiveCell.Offset(a + c).Activate
If (ActiveCell.value="yes") Then Exit Do
c = c + 1
If c < 5 Then Exit Do
Loop
ActiveCell.Offset(0, -1).Activate
plyearsV(a) = ActiveCell.value
ActiveCell.Offset(0, -1).Activate
namesv(a) = ActiveCell.value
Next a
The code does the following
It goes to a reference, and moves down a row untill it finds a cell
with the value "yes"
When this cell is fouund it adds the two values offsetting the cell to
a different array.
Then it goes back to the start and moves down to the cell after this
one.
The problem is that the activecell.value function is always reading as
"no", even when the input value is "yes".
Thanks
Dave
I am attempting some programming and I am having trouble with the
activecell command within a do loop.
What I am attempting to do is go through a row and have an event occurr
on particular cell values. The problem is that when I attempt to the use
the activecell.value command to trigger the loop to stop excel does not
appear to read the cell value and thus stop the loop. It does not
appear to read the cell value property.
Can you advise me whether I am doing something completely incorrect, or
whether there is another way to have the program read a cell value and
trigger an output.
Here is an example of the code I am using
For a = 1 To n
Application.Goto reference:="project_inclusion_start"
c = 0
Do Until ((ActiveCell.value) ="yes")
e = a + c
ActiveCell.Offset(a + c).Activate
If (ActiveCell.value="yes") Then Exit Do
c = c + 1
If c < 5 Then Exit Do
Loop
ActiveCell.Offset(0, -1).Activate
plyearsV(a) = ActiveCell.value
ActiveCell.Offset(0, -1).Activate
namesv(a) = ActiveCell.value
Next a
The code does the following
It goes to a reference, and moves down a row untill it finds a cell
with the value "yes"
When this cell is fouund it adds the two values offsetting the cell to
a different array.
Then it goes back to the start and moves down to the cell after this
one.
The problem is that the activecell.value function is always reading as
"no", even when the input value is "yes".
Thanks
Dave