+ Reply to Thread
Results 1 to 4 of 4

Variables in Excel

  1. #1
    Lang
    Guest

    Variables in Excel

    Hi,

    I'm having a hard time figuring out how to set a variable in a macro equal
    to the value in a cell. I then want to be able to use that value with the
    select method to select a number of rows equal to the value of my variable.

    The big problem for me is going from the spreadsheet to the macro with a
    value.
    Any help appreciated.

    Thanks,

    Lang

  2. #2
    Don Guillett
    Guest

    Re: Variables in Excel

    will this work?

    Sub selectrows()
    Rows("1:" & Range("b10")).Select
    End Sub

    --
    Don Guillett
    SalesAid Software
    [email protected]
    "Lang" <[email protected]> wrote in message
    news:[email protected]...
    > Hi,
    >
    > I'm having a hard time figuring out how to set a variable in a macro equal
    > to the value in a cell. I then want to be able to use that value with the
    > select method to select a number of rows equal to the value of my

    variable.
    >
    > The big problem for me is going from the spreadsheet to the macro with a
    > value.
    > Any help appreciated.
    >
    > Thanks,
    >
    > Lang




  3. #3
    Lang
    Guest

    Re: Variables in Excel

    thanks for the reply Don! I didn't get a chance to check this today, but
    will try soon.

    Lang

    "Don Guillett" wrote:

    > will this work?
    >
    > Sub selectrows()
    > Rows("1:" & Range("b10")).Select
    > End Sub
    >
    > --
    > Don Guillett
    > SalesAid Software
    > [email protected]
    > "Lang" <[email protected]> wrote in message
    > news:[email protected]...
    > > Hi,
    > >
    > > I'm having a hard time figuring out how to set a variable in a macro equal
    > > to the value in a cell. I then want to be able to use that value with the
    > > select method to select a number of rows equal to the value of my

    > variable.
    > >
    > > The big problem for me is going from the spreadsheet to the macro with a
    > > value.
    > > Any help appreciated.
    > >
    > > Thanks,
    > >
    > > Lang

    >
    >
    >


  4. #4
    Registered User
    Join Date
    02-04-2004
    Posts
    23
    to use the value of a range (cell) in a macro, use the syntax:
    Please Login or Register  to view this content.
    where "a1" is value of interest.
    then, to select a row use
    Please Login or Register  to view this content.
    to select that row number, or
    Please Login or Register  to view this content.
    to select that number of rows

+ Reply to Thread

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.6.0 RC 1