+ Reply to Thread
Results 1 to 4 of 4

Running an if condition looped with another if condition in VBA

  1. #1
    Registered User
    Join Date
    05-03-2010
    Location
    New delhi
    MS-Off Ver
    Excel 2007
    Posts
    2

    Question Running an if condition looped with another if condition in VBA

    Hi,

    I was trying to run an if condition, post another if condition in a loop; which does not seem to work.


    Suppose if i'm searching for people whose names start with "A" and if the name starts with an "A" is it "Anuj". In this case running an if condition internal to another if condition does not seem to work. Can some1 help me with how this thing works?

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482

    Re: Running an if condition looped with another if condition in VBA

    To best describe or illustrate your problem you would be better off attaching a dummy workbook, the workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    If needed supply a before and after sheet in the workbook so the person helping you can see what you are trying to achieve.

    Doing this will ensure you get the result you need!

  3. #3
    Registered User
    Join Date
    05-03-2010
    Location
    New delhi
    MS-Off Ver
    Excel 2007
    Posts
    2

    Question Re: Running an if condition looped with another if condition in VBA

    In the sheet attached, there are three tables having different number of options for each. For every table needs to have a starting and an ending point defined as D* and F* respectively.

    The starting and ending points then have to be represented as D*:F*; like shown in the output table in column G. The way I was trying to do this was first find cell which starts with D, then search for next cell which starts with F and concatenate both and do this in a loop but was not able to do the nesting for this.

    Since the table lengths are dynamic in nature, i think it can be only be done using a macro.

    Can someone help me on this.
    Attached Files Attached Files

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482

    Re: Running an if condition looped with another if condition in VBA

    I could not get it to work without a helper column, Click the button to run the macro.
    Attached Files Attached Files

+ 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