Results 1 to 3 of 3

Thread: keep a variable from one function to another

  1. #1
    Larry Kevin is offline Senior Member
    Join Date
    May 2011
    Posts
    199
    Rep Power
    2

    Default keep a variable from one function to another

    Hi all, On my program, I have three functions are: Sub Worksheet_Change (ByVal Target As Range) which performs a first seizure saisie2 sub () that allows manual entry of the remaining cells calculation sub () that performs the calculations according to information previously met the problem is: I use the Worksheet_Change function i = Target.Row to have the selected row => date_travaux = Rang, However, the value of i disappears as soon as I leave my job Sub Worksheet_Change . What's the reason? I counter this problem and if so how? Thank you for the attention and good luck

  2. #2
    Henry Orson is offline Senior Member
    Join Date
    May 2011
    Posts
    216
    Rep Power
    2

    Default

    Hello, I was somewhat missing these days , Have you solved your problem? There are two ways to resolve this issue but we should learn more about how you leave the Sub Worksheet_Change and how you call saisie2 () and calculated () A small demo file attached would be welcome.

  3. #3
    Sidonia Donan is offline Senior Member
    Join Date
    May 2011
    Posts
    218
    Rep Power
    2

    Default

    Hello, You're in a sub, you defined in your variables? for as the saying galopin01, there are two ways: Or you set your variable i in public, but in this case i will be used in all your subs (like all other variables would you have said in public). therefore, we must be careful in the choice of these variables public Or you use a function instead of a sub for you that it returns the value

Similar Threads

  1. Tuple variable in SQL
    By GonzalezBrown in forum Programming
    Replies: 1
    Last Post: 04-21-2010, 01:41 PM
  2. Variable in a VBA macro
    By Alexavier Nash in forum Programming
    Replies: 4
    Last Post: 10-22-2009, 12:38 PM
  3. How to Extract variable "file" and "path" of a variable
    By Halle Berry in forum Software Jargons
    Replies: 1
    Last Post: 10-20-2009, 10:55 AM
  4. What's with all these variable types?
    By Kaiven Boycott in forum Programming
    Replies: 0
    Last Post: 09-30-2009, 12:42 PM
  5. The 'variable'
    By quckhil in forum Programming
    Replies: 0
    Last Post: 08-22-2008, 09:20 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
  •  
SEO by SubmitEdge

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48