+ Reply to Thread
Results 1 to 3 of 3

Variable in Range

  1. #1
    aftamath
    Guest

    Variable in Range

    This is my code:

    Sub Macro1()

    Dim intRow As Integer
    intRow = InputBox(Prompt:="Enter Age", Title:="Age")

    Application.Worksheets("Mold Flg Thk").Rows("10:19").Insert

    End Sub

    I would like to use the intRow variable in the .Rows range. But,

    Application.Worksheets("Mold Flg Thk").Rows("10:intRow").Insert

    doesn't work and neither do a few other variations.

    Can the range be defined using the intRow variable?

  2. #2
    Dave Peterson
    Guest

    Re: Variable in Range

    Application.Worksheets("Mold Flg Thk").Rows("10:" & introw).Insert



    aftamath wrote:
    >
    > This is my code:
    >
    > Sub Macro1()
    >
    > Dim intRow As Integer
    > intRow = InputBox(Prompt:="Enter Age", Title:="Age")
    >
    > Application.Worksheets("Mold Flg Thk").Rows("10:19").Insert
    >
    > End Sub
    >
    > I would like to use the intRow variable in the .Rows range. But,
    >
    > Application.Worksheets("Mold Flg Thk").Rows("10:intRow").Insert
    >
    > doesn't work and neither do a few other variations.
    >
    > Can the range be defined using the intRow variable?


    --

    Dave Peterson

  3. #3
    Trevor Shuttleworth
    Guest

    Re: Variable in Range

    Try:

    Application.Worksheets("Mold Flg Thk").Rows("10:" & intRow).Insert

    Regards

    Trevor


    "aftamath" <aftamath@discussions.microsoft.com> wrote in message
    news:71818AC6-294A-48A3-BD3B-E6F201BB682B@microsoft.com...
    > This is my code:
    >
    > Sub Macro1()
    >
    > Dim intRow As Integer
    > intRow = InputBox(Prompt:="Enter Age", Title:="Age")
    >
    > Application.Worksheets("Mold Flg Thk").Rows("10:19").Insert
    >
    > End Sub
    >
    > I would like to use the intRow variable in the .Rows range. But,
    >
    > Application.Worksheets("Mold Flg Thk").Rows("10:intRow").Insert
    >
    > doesn't work and neither do a few other variations.
    >
    > Can the range be defined using the intRow variable?




+ 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