+ Reply to Thread
Results 1 to 5 of 5

How do I activate my code in other sheet?

  1. #1
    Registered User
    Join Date
    01-22-2013
    Location
    Kl, Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    35

    How do I activate my code in other sheet?

    Hi,

    My code can only be activated when I am on a specific sheet ("Data"), how do I enable the code to be activated on other sheet ("KMV-Merton").


    Option Explicit
    Private Const dmax = 250

    Sub LatestDate()
    'Find the last used row in a Column: column A in this example
    Dim LastRow As Long
    With Worksheets("Data")
    LastRow = .Cells(.Rows.Count, "A").End(xlUp).row
    End With

    'CopyPaste the value of recent trading day dates
    With Worksheets("Data")
    .Range(Cells((LastRow - dmax + 1), 1), Cells(LastRow, 1)).Copy
    End With
    With Worksheets("KMV-Merton")
    .Cells(2, "H").PasteSpecial xlPasteValuesAndNumberFormats
    End With
    End Sub

  2. #2
    Registered User
    Join Date
    01-21-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    37

    Re: How do I activate my code in other sheet?

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    01-22-2013
    Location
    Kl, Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    35

    Re: How do I activate my code in other sheet?

    Hi sky1in5,

    Thank you very much for your reply.

    I tried to add in the suggested code, but the debugging msg
    appears on "Range(Cells((LastRow - dmax + 1), 1), Cells(LastRow, 1)).Copy" with yellow highlight

    Sorry I am a beginner here, please help me further. I might misinterpret your post.

    Thanks.

  4. #4
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: How do I activate my code in other sheet?

    We would love to continue to help you with your query, but first, before we can proceed, please see Forum Rule #3 about code tags and adjust accordingly...
    HTH
    Regards, Jeff

  5. #5
    Registered User
    Join Date
    01-21-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    37

    Re: How do I activate my code in other sheet?

    Hi Jeffreybrown,

    I dont see there is a need to deleted my post because

    1st : User is not online, therefore he/she is unable to edit post or post new reply.
    2nd : With a minor coding tag issue, are you going to stop people from helping them to solve their problem

    Sorry if i offended you, but i am trying to understand why am i getting a warning private message instead of a normal private message telling me the issue. Thank you.

+ 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