+ Reply to Thread
Results 1 to 2 of 2

Thread: if condition - vba- chakri

  1. #1
    Registered User
    Join Date
    01-04-2012
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    13

    if condition - vba- chakri

    I have two sheets . If the user enters a value in b24 as "FIXED" in sheet1

    While the user access / enters sheet 2 i am trying to create a pop message stating that " you require two set of documents "

    For this i have written a code in sheeet 2

    Private Sub Worksheet_Activate() ' in sheet 2

    Dim ws As Worksheets

    Set ws = Worksheets("sheet 1")


    If ws.Range("b24").Value = "FIXED" Then MsgBox " PLEASE NOTE U REQUIRE TO ISSUE TWO SETS "

    End Sub


    error message : " run time error '13' type mis match

    i am fairly new to the excel vba. thanx in advance
    Last edited by grk_chakri; 01-26-2012 at 01:11 PM. Reason: incorrect information

  2. #2
    Valued Forum Contributor
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    1,958

    Re: if condition - vba- chakri

    Hi - could you please read the forum rules and use code tags when you post code, please?

    I think your problem is that ws needs to be a Worksheet object, not a Worksheets one. Try:

    Private Sub Worksheet_Activate() ' in sheet 2
    
     Dim ws As Worksheet
    
     Set ws = Sheets("sheet 1")
    
    
     If ws.Range("b24").Value = "FIXED" Then MsgBox " Please note, you require two sets of documents."
    
     End Sub

+ 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.2.0