+ Reply to Thread
Results 1 to 10 of 10

EXCEL: Value Changed After End Sub

  1. #1
    Forum Contributor
    Join Date
    12-28-2012
    Location
    Mumbai - India
    MS-Off Ver
    Excel
    Posts
    145

    EXCEL: Value Changed After End Sub

    I' have created 1 Integer in Module,

    Set the Value as "1" in Module RunTime [WrokBook Open = 0]

    I' want to use the same in WorkSheet Selection Change Event,

    But After Module End Sub, The Value is coming back to 0

    Need Help with the same.

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: EXCEL: Value Changed After End Sub

    sounds like you declared the variable with the wrong scope-did you declare it public?
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Forum Contributor
    Join Date
    12-28-2012
    Location
    Mumbai - India
    MS-Off Ver
    Excel
    Posts
    145

    Re: EXCEL: Value Changed After End Sub

    Yes

    I' have declared it Public

    Also Tried declaring both at Workbook & Module level

    Still it is not working

    As Below:
    Public DSPCheck As Integer

  4. #4
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: EXCEL: Value Changed After End Sub

    that oughta work. where is that code located?

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: EXCEL: Value Changed After End Sub

    It should be declared once, in a standard module.
    If posting code please use code tags, see here.

  6. #6
    Forum Contributor
    Join Date
    12-28-2012
    Location
    Mumbai - India
    MS-Off Ver
    Excel
    Posts
    145

    Re: EXCEL: Value Changed After End Sub

    i' am saying that I' have tried at both location... not at the same time

  7. #7
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: EXCEL: Value Changed After End Sub

    it should work unless you reset the code state. please provide a workbook showing where it doesn't work

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: EXCEL: Value Changed After End Sub

    Well if it's been declared in a standard module and has been given a value in workbook open it should still have that value, unless something has happened inbetween that could cause it to lose it's value.

  9. #9
    Forum Contributor
    Join Date
    12-28-2012
    Location
    Mumbai - India
    MS-Off Ver
    Excel
    Posts
    145

    Re: EXCEL: Value Changed After End Sub

    I' am not able to find which code is running in between
    can we get the sequence of code run [no debugging because more than thousand rows] so I' can find where it is getting change.

  10. #10
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: EXCEL: Value Changed After End Sub

    you need to learn how to debug ;-)
    add a watch to the variable and set it to break whenever the value changes

+ 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