+ Reply to Thread
Results 1 to 3 of 3

Troubleshooting If statement

Hybrid View

dcgrove Troubleshooting If statement 04-12-2011, 11:43 AM
tigeravatar Re: Troubleshooting If... 04-12-2011, 12:06 PM
dcgrove Re: Troubleshooting If... 04-12-2011, 12:09 PM
  1. #1
    Forum Contributor
    Join Date
    02-16-2008
    Location
    Mansfield, TX
    Posts
    324

    Troubleshooting If statement

    The macro below is intended to call a macro named idgenerator, then check to see if range G8:H8 is not blank, and then save the workbook to a specific location but is failing to a type mismatch error on the first line of the if statement. Can anyone shed some light on this?

    Public Sub nonprotsaveas()
    Call IDgenerator
    
    
    If ActiveSheet.Range("G8:H8") = "" Then
       MsgBox ("Please select a product category before sending this request")
       Exit Sub
      End If
      
    ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\udcg012\My Documents\Sample Request Project\Non Protein\" & Range("G8:H8") & "\" & Range("c3").Value & " " & Range("c5").Value & " " & Format$(Date, "mm-dd-yyyy") & ".xlsm"
    End Sub

    Thanks!
    Clayton Grove
    Last edited by dcgrove; 04-12-2011 at 12:09 PM.

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Troubleshooting If statement

    Clayton,

    Try this instead:

    If IsEmpty(ActiveSheet.Range("G8")) And IsEmpty(ActiveSheet.Range("H8")) Then


    Hope this helps,
    ~tigeravatar

  3. #3
    Forum Contributor
    Join Date
    02-16-2008
    Location
    Mansfield, TX
    Posts
    324

    Re: Troubleshooting If statement

    That worked!

    thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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