+ Reply to Thread
Results 1 to 3 of 3

Selecting the right cells....

  1. #1
    Forum Contributor
    Join Date
    03-14-2005
    Location
    Sweden
    MS-Off Ver
    Office 365
    Posts
    329

    Selecting the right cells....

    Hello.

    I try to select a range but the macro is hard coded into a specific range. I want it to be flexible depending on the number of rows.
    How do I do this?
    Here is the macro:
    Please Login or Register  to view this content.
    I want to remove the A3:O70 part. Instead I want the selection to select all rows were there are inputs from column A to O.

    How should I write this code?

    Thanks
    /Anders

  2. #2
    Norman Jones
    Guest

    Re: Selecting the right cells....

    Hi A94andwi,

    Try something like:

    '=============>>
    Public Sub Tester()
    Dim LRow As Long

    LRow = Cells(Rows.Count, "A").End(xlUp).Row

    With Range("A3:A" & LRow)
    .Interior.ColorIndex = 36
    End With

    End Sub
    '<<=============


    ---
    Regards,
    Norman



    "a94andwi" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hello.
    >
    > I try to select a range but the macro is hard coded into a specific
    > range. I want it to be flexible depending on the number of rows.
    > How do I do this?
    > Here is the macro:
    >
    > Code:
    > --------------------
    > Sub C612ToYellow()
    > '
    > ' C612ToYellow Macro
    > ' Macro recorded 2006-03-03 by ks32480
    > '
    > ' Keyboard Shortcut: Ctrl+Shift+E
    > '
    > Range("A3").Select
    > Range(Selection, Selection.End(xlDown)).Select
    > Range("A3:O70").Select
    > With Selection.Interior
    > .ColorIndex = 36
    > .Pattern = xlSolid
    > End With
    > Range("A3").Select
    > Selection.End(xlDown).Select
    >
    > End Sub
    > --------------------
    >
    > I want to remove the A3:O70 part. Instead I want the selection to
    > select all rows were there are inputs from column A to O.
    >
    > How should I write this code?
    >
    > Thanks
    > /Anders
    >
    >
    > --
    > a94andwi
    > ------------------------------------------------------------------------
    > a94andwi's Profile:
    > http://www.excelforum.com/member.php...o&userid=21077
    > View this thread: http://www.excelforum.com/showthread...hreadid=519692
    >




  3. #3
    Forum Contributor
    Join Date
    03-14-2005
    Location
    Sweden
    MS-Off Ver
    Office 365
    Posts
    329
    Thank you very much. It helped a lot.

    /Anders

+ 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