Consulting

Results 1 to 4 of 4

Thread: Simplify and automate

  1. #1
    VBAX Regular
    Joined
    Mar 2005
    Posts
    16
    Location

    Simplify and automate

    Hi,

    I wonder if the code below can be changed so I dont need to run the macro every time? What I want is that every time i make a sheet active I want a specific cell to be active even if i leave the sheet when another cell is active.

    I have solved it by a macro that runs when the sheet is activated, but I wonder if it can be done without a macro?

    Here is the code:

    Private Sub Worksheet_Activate()
        Call RememberActive
    End Sub
     
    Sub RememberActive()
    Dim r As Long, c As Integer
    Sheets(3).Activate
    Range("F12").Select
        r = ActiveCell.Row
        c = ActiveCell.Column
    End Sub

    Rgds
    /Phprahl

  2. #2
    VBAX Master Killian's Avatar
    Joined
    Nov 2004
    Location
    London
    Posts
    1,132
    Location
    Hi,

    I don't think there is a way of doing this without code but thats what the code (and especially a workbook/sheet event) is for. The following line in the activate event for the sheet (rather than the workbook), activates a specified cell

    Range("F12").Activate
    K :-)

  3. #3
    What exactly do you want to do with the row and column afterwards?

  4. #4
    VBAX Regular
    Joined
    Mar 2005
    Posts
    16
    Location
    How simple....Exactly what I wanted, Killian!

    Thanks!

Posting Permissions

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