+ Reply to Thread
Results 1 to 6 of 6

Macro (button) that brings you back to the top

Hybrid View

SHELTONUNDERDOG Macro (button) that brings... 03-30-2015, 03:21 PM
buran Re: Macro (button) that... 03-30-2015, 03:42 PM
SHELTONUNDERDOG Re: Macro (button) that... 03-30-2015, 03:57 PM
buran Re: Macro (button) that... 03-30-2015, 03:59 PM
kosherboy Re: Macro (button) that... 03-30-2015, 04:00 PM
SHELTONUNDERDOG Re: Macro (button) that... 03-30-2015, 04:04 PM
  1. #1
    Registered User
    Join Date
    11-05-2012
    Location
    shelton, wa
    MS-Off Ver
    Office 365
    Posts
    24

    Macro (button) that brings you back to the top

    Hello, I have a three macros assigned to three form control buttons. You click on the first it takes you to Cell B9, you click on the second it will take you to Cell B321, and the third will take you to Cell B488.

    My problem is if I am down at row 321 and want to quickly go back to the top row I click on the first button, works fine unless I have that row hidden then the curser is in the hidden row (cell B9) but the sheet does not auto scroll up. How can I make it scroll back up and still have the option of hiding the row?

    (Rows 1-8 are set for Freeze Pane, row 9 is the first possible line of data that could be entered)

  2. #2
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: Macro (button) that brings you back to the top

    ActiveWindow.ScrollRow=9
    If you are pleased with a member's answer then use the Star icon to rate it.

  3. #3
    Registered User
    Join Date
    11-05-2012
    Location
    shelton, wa
    MS-Off Ver
    Office 365
    Posts
    24

    Re: Macro (button) that brings you back to the top

    how would I plant that in my macro:

    Sub Button ()
    Range("B9").Select
    End Sub

  4. #4
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: Macro (button) that brings you back to the top

    Sub Button ()
    ActiveWindow.ScrollRow=9
    Range("B9").Select
    End Sub

  5. #5
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Waterbury, CT
    MS-Off Ver
    Office 365
    Posts
    1,175

    Re: Macro (button) that brings you back to the top

    Hi.
    Try this:

    Private Sub CommandButton1_Click()
    Dim i As Long
    Dim j As Long
    
    Application.GoTo Cells(Rows.Count, "B").End(xlUp), Scroll:=True
    With ActiveWindow
    i = .VisibleRange.Rows.Count / 2
    j = .VisibleRange.Columns.Count / 2
    .SmallScroll Up:=i, ToLeft:=j
    End With
    End Sub
    Last edited by kosherboy; 03-30-2015 at 04:02 PM.

  6. #6
    Registered User
    Join Date
    11-05-2012
    Location
    shelton, wa
    MS-Off Ver
    Office 365
    Posts
    24

    Re: Macro (button) that brings you back to the top

    Thank you Buran, that works perfectly!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Command button brings up picture viewer instead of running macro.
    By Epscan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-28-2015, 10:39 AM
  2. Replies: 7
    Last Post: 06-30-2014, 01:51 AM
  3. COUNTIF brings back too many numbers
    By jceg316 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-08-2013, 11:50 AM
  4. Insert a button that brings up a form?
    By danielgri14 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-10-2011, 11:17 PM
  5. [SOLVED] my sumif statement brings back mutiple answers, how do I fix it?
    By graham in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-15-2005, 04:15 PM

Tags for this Thread

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