+ Reply to Thread
Results 1 to 5 of 5

Make this macro select active sheet

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    12-14-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    102

    Make this macro select active sheet

    How do I set this macro to the activesheet rather than a named sheet?

    Sub FillBlanks()
        Dim Lastrow As Double
        'Fills Blank Cells with the Value of 0
        
        Worksheets("InputData").Activate
        
        'get Last row of data assume Column A has data on Lastrow
        Lastrow = Range("A65000").End(xlUp).Row
        'fill all blank cells within data range to 0
        Range("A3:A400" & Lastrow).SpecialCells(xlCellTypeBlanks).Value = "-"
    End Sub
    Last edited by smugglersblues; 01-10-2013 at 05:52 PM.

  2. #2
    Forum Contributor ragavan.sridar1's Avatar
    Join Date
    11-19-2012
    Location
    India
    MS-Off Ver
    Excel 2010, Excel 2003
    Posts
    208

    Re: Make this macro select active sheet

    Just try using "Activesheet.select"
    Thanks!
    Raga.

    Please,mark your thread [SOLVED] if you received your answer.

    Click the little star * below, to give some Rep if you think an answer deserves it.

    I learnt so many things from these links.

  3. #3
    Valued Forum Contributor
    Join Date
    06-19-2010
    Location
    Holywell, N Wales, UK
    MS-Off Ver
    Excel 2013
    Posts
    470

    Re: Make this macro select active sheet

    The sheet you are on is the ActiveSheet
    Therefore just delete or comment-out the reference to
    Worksheets("InputData").Activate
    If this was helpful then please click the small star icon at the bottom left of my post. A little appreciation goes a long way.

  4. #4
    Forum Contributor
    Join Date
    12-14-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    102

    Re: Make this macro select active sheet

    barry your tip solved the problem. Thanks for the replies.

  5. #5
    Valued Forum Contributor
    Join Date
    06-19-2010
    Location
    Holywell, N Wales, UK
    MS-Off Ver
    Excel 2013
    Posts
    470

    Re: Make this macro select active sheet

    Pleasure.
    Please mark your thread as SOLVED
    barry

+ 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