Thanks JL - nearly there although I can't quite get this to work. It would
seem the ibox variable isn't carrying the value entered by the user. It just
inputs 1 - 28 (on each loop) and the ibox is empty. When I put the .value to
the ibox it comes up with an 'expected: end of statement' message. I tried
declaring each of the iboxes (ibox1, ibox2) etc in the 'Declarations' part
but to no avail (another error message).
"JLGWhiz" wrote:
> Should be: For i = 1 to 28
> Sheet19.Cells(i + 4, c) = Sheet19.Cells(i + 4, c) +
> (ibox & i).Value
> next i
>
>
> "JLGWhiz" wrote:
>
> > First of all, I am assuming you made a typo with:
> >
> > Sheet19.Cells(5, c) = Sheet19.Cells(5, c) + ibox1.Value
> > Sheet19.Cells(6, c) = Sheet19.Cells(5, c) + ibox2.Value
> >
> > and the second line should have been
> >
> > Sheet19.Cells(6, c) = Sheet19.Cells(6, c) + ibox2.Value
> >
> > If so, this should work:
> >
> > For i = 1 to 28
> > Sheet19.Cells(i + 4, c) = Sheet19.Cells(i + 4, c) + ibox (i).Value
> > next i
> >
> >
> > "KneeDown2Up" wrote:
> >
> > > I have a number of text boxes (ibox1 - ibox28) all holding data inputed via a
> > > userform. To capture this data I potentially (with my knowledge) need this;
> > >
> > >
> > > Sheet19.Cells(5, c) = Sheet19.Cells(5, c) + ibox1.Value
> > > Sheet19.Cells(6, c) = Sheet19.Cells(5, c) + ibox2.Value
> > > ..and so on.
> > >
> > > I would like to be able to run this within a 'For/Next' loop but keep coming
> > > up against problems.
> > >
> > > For i = 1 to 28
> > > Sheet19.Cells(5, c) = Sheet19.Cells(5, c) + ibox(i).Value
> > > next i
> > >
> > > Why is this? What can I do to make this principle work?
> > >
> > > Any help appreciated, thanks.
|