+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Biomed
    Guest

    Using For - Next Loops in VB

    Excel 2000 SR-1

    I am trying to write a VB code using a For - Next statement to calcualate
    cells.
    The basic satement is:

    For X = 1 to 7
    [A(x)] = {Calcualtion} ' Where A=Column and X = Row
    Next X

    Is there a correct way in VB code? This would greatly reduce the code I
    would have to write otherwise.

  2. #2
    Trevor Shuttleworth
    Guest

    Re: Using For - Next Loops in VB

    One way:

    For X = 1 to 7
    Range("A" & X) = {Calcualtion} ' Where A=Column and X = Row
    Next X

    Regards

    Trevor


    "Biomed" <Biomed@discussions.microsoft.com> wrote in message
    news:15009E4F-5179-4DC8-B455-546716E29D53@microsoft.com...
    > Excel 2000 SR-1
    >
    > I am trying to write a VB code using a For - Next statement to calcualate
    > cells.
    > The basic satement is:
    >
    > For X = 1 to 7
    > [A(x)] = {Calcualtion} ' Where A=Column and X = Row
    > Next X
    >
    > Is there a correct way in VB code? This would greatly reduce the code I
    > would have to write otherwise.




  3. #3
    Biomed
    Guest

    Re: Using For - Next Loops in VB

    Thanks Trevor. Is there a good text you can recommend for learning how to
    program in VB? I'm not completely a novice but "self-taught". I created a
    contacts database in Access that several departments have asked for in the
    hospital where I work because of the ease to generate purchase order requests
    and track the data. It works but I can see a lot of places I could have done
    a better job. Any suggestions would be appreciated.

    Also, Duke, Thanks for your suggestion too. Sorry for the double post - my
    pc crashed and couldn't tell if it it posted my question. I will use both
    suggestions.

    "Trevor Shuttleworth" wrote:

    > One way:
    >
    > For X = 1 to 7
    > Range("A" & X) = {Calcualtion} ' Where A=Column and X = Row
    > Next X
    >
    > Regards
    >
    > Trevor
    >
    >
    > "Biomed" <Biomed@discussions.microsoft.com> wrote in message
    > news:15009E4F-5179-4DC8-B455-546716E29D53@microsoft.com...
    > > Excel 2000 SR-1
    > >
    > > I am trying to write a VB code using a For - Next statement to calcualate
    > > cells.
    > > The basic satement is:
    > >
    > > For X = 1 to 7
    > > [A(x)] = {Calcualtion} ' Where A=Column and X = Row
    > > Next X
    > >
    > > Is there a correct way in VB code? This would greatly reduce the code I
    > > would have to write otherwise.

    >
    >
    >


  4. #4
    Biomed
    Guest

    Re: Using For - Next Loops in VB

    Thanks Trevor. Is there a good text you can recommend for learning how to
    program in VB? I'm not completely a novice but "self-taught". I created a
    contacts database in Access that several departments have asked for in the
    hospital where I work because of the ease to generate purchase order requests
    and track the data. It works but I can see a lot of places I could have done
    a better job. Any suggestions would be appreciated.

    Also, Duke, Thanks for your suggestion too. Sorry for the double post - my
    explorer is not working right and couldn't tell if it it posted my question.
    I will use both suggestions.

    "Trevor Shuttleworth" wrote:

    > One way:
    >
    > For X = 1 to 7
    > Range("A" & X) = {Calcualtion} ' Where A=Column and X = Row
    > Next X
    >
    > Regards
    >
    > Trevor
    >
    >
    > "Biomed" <Biomed@discussions.microsoft.com> wrote in message
    > news:15009E4F-5179-4DC8-B455-546716E29D53@microsoft.com...
    > > Excel 2000 SR-1
    > >
    > > I am trying to write a VB code using a For - Next statement to calcualate
    > > cells.
    > > The basic satement is:
    > >
    > > For X = 1 to 7
    > > [A(x)] = {Calcualtion} ' Where A=Column and X = Row
    > > Next X
    > >
    > > Is there a correct way in VB code? This would greatly reduce the code I
    > > would have to write otherwise.

    >
    >
    >


  5. #5
    Trevor Shuttleworth
    Guest

    Re: Using For - Next Loops in VB

    If you want a book on Excel VBA I'd recommend anything by John Walkenbach.
    I've just bought Excel 2003 Power Programming with VBA which is quite
    literally two inches thick packed with expertise. Excelent book. A
    reasonable price on Amazon.

    If you want Access VBA, I wouldn't know

    Regards

    Trevor


    "Biomed" <Biomed@discussions.microsoft.com> wrote in message
    news:9257847F-7947-4B5D-B8D3-149DF1133E67@microsoft.com...
    > Thanks Trevor. Is there a good text you can recommend for learning how to
    > program in VB? I'm not completely a novice but "self-taught". I created
    > a
    > contacts database in Access that several departments have asked for in the
    > hospital where I work because of the ease to generate purchase order
    > requests
    > and track the data. It works but I can see a lot of places I could have
    > done
    > a better job. Any suggestions would be appreciated.
    >
    > Also, Duke, Thanks for your suggestion too. Sorry for the double post -
    > my
    > pc crashed and couldn't tell if it it posted my question. I will use both
    > suggestions.
    >
    > "Trevor Shuttleworth" wrote:
    >
    >> One way:
    >>
    >> For X = 1 to 7
    >> Range("A" & X) = {Calcualtion} ' Where A=Column and X = Row
    >> Next X
    >>
    >> Regards
    >>
    >> Trevor
    >>
    >>
    >> "Biomed" <Biomed@discussions.microsoft.com> wrote in message
    >> news:15009E4F-5179-4DC8-B455-546716E29D53@microsoft.com...
    >> > Excel 2000 SR-1
    >> >
    >> > I am trying to write a VB code using a For - Next statement to
    >> > calcualate
    >> > cells.
    >> > The basic satement is:
    >> >
    >> > For X = 1 to 7
    >> > [A(x)] = {Calcualtion} ' Where A=Column and X = Row
    >> > Next X
    >> >
    >> > Is there a correct way in VB code? This would greatly reduce the code
    >> > I
    >> > would have to write otherwise.

    >>
    >>
    >>




Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0