+ Reply to Thread
Results 1 to 3 of 3

Correct syntax

  1. #1
    Registered User
    Join Date
    07-02-2007
    Posts
    11

    Correct syntax

    Im really bad at understanding VBA, so bear with me as I'm just using a shotgun approach.

    Why is this wrong?

    Please Login or Register  to view this content.
    Im just trying to have my macro compare the values in cells v5 and v23 and if they are not equal Im going to end the macro.
    Last edited by VBA Noob; 07-07-2007 at 03:14 AM.

  2. #2
    Forum Contributor
    Join Date
    01-10-2006
    Location
    Ahmedabad, India
    MS-Off Ver
    Office 2000
    Posts
    346
    Quote Originally Posted by Paragons
    Im really bad at understanding VBA, so bear with me as I'm just using a shotgun approach.

    Why is this wrong?

    If cell.Value("v5") <> cell.Value("v23") Then
    MsgBox "Finished"
    End If

    Im just trying to have my macro compare the values in cells v5 and v23 and if they are not equal Im going to end the macro.
    Please Login or Register  to view this content.
    But these are basics. I suggest you go through the help file which is very good and gives a lot of information. All the best

    A V Veerkar
    Last edited by avveerkar; 07-07-2007 at 02:14 AM.

  3. #3
    Forum Contributor Tarball's Avatar
    Join Date
    04-21-2007
    Location
    Atlanta, GA
    Posts
    166
    Why is this wrong?
    Originally Posted by Paragons
    Im really bad at understanding VBA, so bear with me as I'm just using a shotgun approach.

    Why is this wrong?

    If cell.Value("v5") <> cell.Value("v23") Then
    MsgBox "Finished"
    End If
    Because when you say "cell" you do not provide any location of what cell you are attempting to compare. Everything in MS-Excel is a range (even a single cell) and you must specifiy the correct range or range address before attempting to compare or modify the cells value.

+ 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