+ Reply to Thread
Results 1 to 4 of 4

IF statement in order to call macro

  1. #1
    Registered User
    Join Date
    06-18-2014
    Location
    new york, usa
    MS-Off Ver
    MS Office 13
    Posts
    4

    IF statement in order to call macro

    I would like to create a macro that will check if there is any text in cells A2, A3, A4, ect and if it contains any text, a specific macro will follow. At the moment I wrote something that checks if the value is a specific text, (Chernick) but I would like it to run if ANY text is in the cell. How would I go about doing this?
    (The actual URL in my code has been replaced to do sensitive data)

    Any help would be appreciated, Thanks!


    Sub Macro_1()

    If ThisWorkbook.Sheets("Sheet45").Range("A2").Value = "Chernick" Then


    Workbooks.Open Filename:= _
    "URL"
    Sheets("Data").Select
    Range("Table1[[Assignee]:[Verified in Build - UIS]]").Select
    Selection.ClearContents
    Range("E11").Select
    Sheets("Closed_Data").Select
    Range("Table16[[Assignee]:[Verified in Build - UIS]]").Select
    Selection.ClearContents
    Range("E10").Select
    Sheets("Data").Select
    Windows("Copy of ER Defects.Find Rates.1.0.xlsm").Activate
    Sheets("NEW_60513").Select
    Range("B9:BS140").Select
    Selection.Copy
    Windows("JUL2014 - Chernick - QA Daily Status (Input).xlsx").Activate
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Range("E12").Select
    Sheets("Closed_Data").Select
    Windows("Copy of ER Defects.Find Rates.1.0.xlsm").Activate
    Sheets("NEW_60514").Select
    Range("B9:AW1008").Select
    Application.CutCopyMode = False
    Selection.Copy
    Windows("JUL2014 - Chernick - QA Daily Status (Input).xlsx").Activate
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Range("F13").Select
    Sheets("Closed-Proj").Select
    Application.CutCopyMode = False
    ActiveWorkbook.RefreshAll
    ActiveWorkbook.Save
    ActiveWindow.Close
    Sheets("Sheet45").Select

    End If

    End Sub

  2. #2
    Forum Contributor
    Join Date
    01-03-2013
    Location
    Aberdeen, Scotland
    MS-Off Ver
    Excel 2007
    Posts
    163

    Re: IF statement in order to call macro

    Maybe try:

    Please Login or Register  to view this content.
    or

    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: IF statement in order to call macro

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    06-18-2014
    Location
    new york, usa
    MS-Off Ver
    MS Office 13
    Posts
    4

    Re: IF statement in order to call macro

    Thanks for the replies everyone, the suggestion by stnkynts was exactly what I was looking for.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] How do I "call" a macro as part of an 'if' statement
    By Dragman in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-15-2013, 06:25 PM
  2. Call back an order and modify or delete it !
    By apla in forum Excel Programming / VBA / Macros
    Replies: 52
    Last Post: 10-10-2013, 11:14 AM
  3. [SOLVED] Insert macro name in code on call statement.
    By MarvInBoise in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-07-2006, 01:10 PM
  4. Call a sub statement in "Personal Macro Workbook" from "ThisWorkbo
    By QC Coug in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-26-2005, 03:05 PM
  5. Call a VBA function in an IF Statement
    By Helpmeplease in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-27-2005, 10:47 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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1