+ Reply to Thread
Results 1 to 3 of 3

Variable for column selection

  1. #1
    Mats W.
    Guest

    Variable for column selection

    Hi,

    I use the script;
    Range("D" & Rows.Count).End(xlUp).Offset(1).Select
    ...to check for the last row in a given column.

    but I need to change the column D to a variable. I tried different ways to
    write that without success. Appreciate if someone can give a hint!

    Thanks!
    --
    Mats W.

  2. #2
    Toppers
    Guest

    RE: Variable for column selection

    One way:

    Dim colvar As String
    colvar = "D"
    Range(colvar & Rows.Count).End(xlUp).Offset(1).Select

    "Mats W." wrote:

    > Hi,
    >
    > I use the script;
    > Range("D" & Rows.Count).End(xlUp).Offset(1).Select
    > ..to check for the last row in a given column.
    >
    > but I need to change the column D to a variable. I tried different ways to
    > write that without success. Appreciate if someone can give a hint!
    >
    > Thanks!
    > --
    > Mats W.


  3. #3
    Bob Phillips
    Guest

    Re: Variable for column selection

    Dim iCol As Long


    Cells(Rows.Count, iCol).End(xlUp).Offset(1).Select

    --
    HTH

    Bob Phillips

    "Mats W." <[email protected]> wrote in message
    news:[email protected]...
    > Hi,
    >
    > I use the script;
    > Range("D" & Rows.Count).End(xlUp).Offset(1).Select
    > ..to check for the last row in a given column.
    >
    > but I need to change the column D to a variable. I tried different ways to
    > write that without success. Appreciate if someone can give a hint!
    >
    > Thanks!
    > --
    > Mats W.




+ 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