Results 1 to 2 of 2

If statement inside and if statement...possible in VBA?

Threaded View

strud If statement inside and if... 07-30-2013, 07:19 AM
nilem Re: If statement inside and... 07-30-2013, 07:42 AM
  1. #1
    Forum Contributor
    Join Date
    04-19-2013
    Location
    Yorkshire, England
    MS-Off Ver
    Excel 2010
    Posts
    297

    If statement inside and if statement...possible in VBA?

    Hi guys,

    I'm wandering whether it is possible to place several if statements inside overarching if statements in VBA in the same way you can do it using formulas.

    So for instance, I have two overarching if statements which are:

    If Sheets("Parent Input").Range("C7").Value = "UK" Then
    and

    If Sheets("Parent Input").Range("C7").Value = "DE" Then
    So if the first is true then:

    If Sheets("Child Input").Range("E:F").EntireColumn.Hidden = False Then
            Sheets("Helper cells").Range("11:11").Copy
            Sheets("Output (UK)").Range("A65536").End(xlUp).Offset(1, 0).PasteSpecial _
                Paste:=xlPasteValues
            Application.CutCopyMode = False
        End If
    and if the second is true then:

    If Sheets("Child Input").Range("E:F").EntireColumn.Hidden = False Then
            Sheets("Helper cells").Range("11:11").Copy
            Sheets("Output (DE)").Range("A65536").End(xlUp).Offset(1, 0).PasteSpecial _
                Paste:=xlPasteValues
            Application.CutCopyMode = False
        End If
    Note that the output sheet being copied to is different in the last two bits of code above.

    Hence it would be an IF following on from the initial IF.

    Eventually I want to end up with lots of further IFS following on from the overarching one.


    Any ideas how I would go about this? (I hope I have explained this adequately though I think probably not)

    Massive thanks in advance for any help

    Strud
    Last edited by strud; 07-30-2013 at 07:41 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Using a VLOOKUP and IF statement inside an IF statement
    By Isis3 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-08-2011, 07:04 PM
  2. Using Next inside an IF statement
    By ChemistB in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-13-2010, 10:27 AM
  3. if-statement inside an if-statement
    By ebswd in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-18-2009, 12:39 AM
  4. If, then inside a for, next statement?
    By EnergyEngineer in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 10-10-2007, 05:04 PM
  5. vlookup inside an if statement?
    By carlosgdlf in forum Excel General
    Replies: 3
    Last Post: 08-03-2005, 09:36 PM

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