+ Reply to Thread
Results 1 to 3 of 3

Need an autoselect macro that is activated by a button

Hybrid View

lauraexcels Need an autoselect macro that... 08-28-2013, 11:15 AM
tony h Re: Need an autoselect macro... 08-30-2013, 05:57 PM
Kalithro Re: Need an autoselect macro... 08-30-2013, 07:13 PM
  1. #1
    Registered User
    Join Date
    08-26-2013
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    4

    Need an autoselect macro that is activated by a button

    Hi guys

    I am a medical transcriptionist (in training), and I have two ever-growing lists in an excel workbook (on separate sheets). What I would like to do is be able to plop a button down at the top of the sheet, and have a macro that checks to see where the last row and column of data is, and select it. It also needs to work from a starting point, as I don't want to sort column A, and I don't want to sort the first 4 rows. If anyone could give me advice on how to go about doing this, I would really appreciate it. It would be nice, since I am new to VBA, to actually learn how to do it on my own. So guidance, rather than code, would be great! Thanks

  2. #2
    Valued Forum Contributor tony h's Avatar
    Join Date
    03-14-2005
    Location
    England: London and Lincolnshire
    Posts
    1,187

    Re: Need an autoselect macro that is activated by a button

    You can do it simply from the spreadsheet.

    Select the first cell then hold down the CTRL and SHIFT and then press the END button


    click on the * Add Reputation if this was useful or entertaining.

  3. #3
    Forum Contributor
    Join Date
    08-14-2013
    Location
    Florida
    MS-Off Ver
    Excel 2013
    Posts
    105

    Re: Need an autoselect macro that is activated by a button

    Can shorten with some dims.


    ThisWorkbook.Sheets("Sheet2").Range(ThisWorkbook.Sheets("Sheet2").Cells(5, 2), ThisWorkbook.Sheets("Sheet2").Cells(5, 2).SpecialCells(xlLastCell)).Select
    More specific...

    
    Sub Macro1()
    '
    Dim rng As Range
    Dim sh As Worksheet
    
    Set sh = ThisWorkbook.Sheets("Sheet1")
    
        Set rng = sh.Range(sh.Cells(5, 2), sh.Cells(5, 2).SpecialCells(xlLastCell))
    
        With rng
        
        .Sort Key1:=sh.Cells(5, 2), Order1:=xlDescending, Orientation:=xlTopToBottom
        End With
        
    End Sub
    Last edited by Kalithro; 08-30-2013 at 07:22 PM.

+ 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] Macro/s to create Search Bar to filter to search terms entered activated by Command Button
    By JasonRay in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-08-2013, 03:44 PM
  2. button activated in different lines
    By flamenguistadf in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-26-2011, 06:11 AM
  3. Exit Cell Currently Activated On Push of A Button
    By bbarrene in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-22-2010, 10:17 AM
  4. Selecting Button Just Activated (help!)
    By jpizzle in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-06-2005, 09:35 AM
  5. [SOLVED] UserForm Question:must be activated via a button
    By Tempy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-19-2005, 06:06 AM

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