+ Reply to Thread
Results 1 to 6 of 6

[i] loop in VBA

  1. #1
    Registered User
    Join Date
    04-11-2011
    Location
    Dubai, UAE
    MS-Off Ver
    Excel 2010
    Posts
    3

    Unhappy [i] loop in VBA

    Hello All,

    I want to write a macro in Excel where i have two sheets:
    Sheet 1 = Source
    Sheet 2 = Form

    Sheets("Source").range("B27") is the source range for other formulas.

    the full macro details are as below (which i need to know where i missed)

    ((this macro keeps on looping and does not give the correct value))

    ##
    Please Login or Register  to view this content.
    ##
    Thank you all in advance.
    Last edited by Shiblie; 04-11-2011 at 11:12 PM. Reason: adding extra details

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: [i] loop in VBA

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: [i] loop in VBA

    Hi Shiblie and welcome to the forum (now that you have put code tags around your code)

    Read http://www.anthony-vba.kefra.com/vba/vbabasic1.htm

    You should put your code in a Module instead of behind a worksheet. Behind a worksheet, it is Private.

    See if this code in a module as discribed in the link above does what you want.
    Please Login or Register  to view this content.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Registered User
    Join Date
    04-11-2011
    Location
    Dubai, UAE
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: [i] loop in VBA

    Thank you for the reply.

    however, i need to attach this macro to an event (prrefferably: Select from a drop list).

    how can i add such an event in VBA (since the sheet would be shared for multiple people), and have this macro running?

  5. #5
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: [i] loop in VBA

    Perhaps this will work.
    Keep the event behind the worksheet but the working macro in a module like the below?

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    04-11-2011
    Location
    Dubai, UAE
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: [i] loop in VBA

    Thank You Very Much

    It's working Now!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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