Results 1 to 4 of 4

ActiveCell

This is a discussion on ActiveCell within the Excel Questions forums, part of the Question Forums category; Hi How can i select the cells B:J,M:N,T in the active row? So far i have ActiveCell.Offset(0, -12).Activate this selects ...

  1. #1
    Board Regular
    Join Date
    Aug 2002
    Location
    Adelaide, South Australia
    Posts
    92

    Default

    Hi

    How can i select the cells B:J,M:N,T in the active row?

    So far i have
    ActiveCell.Offset(0, -12).Activate

    this selects the B cell in the active row. How can i select more than one cell?

    Should i explain more, this seems pretty confusing...


    cheers

  2. #2
    MrExcel MVP Mark O'Brien's Avatar
    Join Date
    Feb 2002
    Location
    Columbus, OH, USA
    Posts
    3,530

    Default

    Something like this would work:


    Public Sub main()

    Dim iRow As Long
    Dim sSelections As String

    iRow = ActiveCell.Row
    sSelections = "B" & iRow & ":J" & iRow & ",M" & iRow & ":N" & iRow & ",T" & iRow
    ActiveSheet.Range(sSelections).Select

    End Sub

  3. #3
    Board Regular
    Join Date
    Aug 2002
    Location
    Adelaide, South Australia
    Posts
    92

    Default

    Thats awesome! Thanks

    Its times like these that make me want to enrol in some kind of visual basic tafe course or something.

    Cheers

  4. #4
    MrExcel MVP Mark O'Brien's Avatar
    Join Date
    Feb 2002
    Location
    Columbus, OH, USA
    Posts
    3,530

    Default

    A library card is a cheaper investment. Flick through as many VBA books as they have. You don't need to read the whole book, just look for the interesting bits.

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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


DMCA.com