473,387 Members | 2,436 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

If else end if mismatch error--"else without if"

Hi All,
I am trying to write a macro with VB editor in excel. However when i try to compile my code i get an error saying "ELSE WITHOUT IF"

My code goes like this
Expand|Select|Wrap|Line Numbers
  1.         If name = name1 Then
  2.                 If activity <> activity1 Then GoTo 10
  3.                     If subactivity <> subactivity1 Then
  4.                             GoTo 10
  5.                     Else
  6.                         GoTo 99
  7.                     End If
  8.                 Else
  9.                     GoTo 99
  10.                 End If
  11.        End If
  12.  
Nov 1 '11 #1
1 2057
ADezii
8,834 Expert 8TB
  1. What's causing the Error is incorrect Syntax on Code Line# 2.
  2. Your Overall Logic appears to be flawed.
  3. My best guess as to what you are trying to accomplish would be:
    Expand|Select|Wrap|Line Numbers
    1. If Name = name1 Then
    2.   If activity <> activity1 Then
    3.     If subactivity <> subactivity1 Then
    4.       GoTo 10
    5.     Else
    6.       GoTo 99
    7.     End If
    8.   Else
    9.     GoTo 99
    10.   End If
    11. End If
Nov 1 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: LJgrnl | last post by:
I've got a type mismatch error that's driving me nutty. Variable blnNoData has the initial value False. If a recordset comes back empty (both .EOF and ..BOF are true) then blnNoData is set to...
7
by: middletree | last post by:
I've been messing with this for hours, and have been to various sites, including Aaron's site, and am truly stumped. The short version: in SQL Server, the 4 fields in question are datetime. I...
2
by: Chris Fonnesbeck | last post by:
I'm trying to run the latest Postgresql on OSX 10.3, but am receiving a version mismatch error when I try and run the database: dyld: psql version mismatch for library:...
7
by: El kroty | last post by:
Hi folks!! i'm trying to write k&r ex1-24 without a stack. I almost have it but there's a bug that makes me crazy and can't find it :'( whit some files it works and with others it doesn't. Here is...
32
by: Conrad Weyns | last post by:
I have recently gone back to doing some work in c, after years of c++, but I find the lack of templates and in particular the container in the stl to be a huge show stopper. There are math libs,...
6
by: shan | last post by:
What is the meaning for the error expression syntax and type mismatch error.I am using turbo c++.can anybody correct the errors in the folowing program. Following program is to find matrix...
4
by: sara | last post by:
I have an A2K database that has links to 3 of my other databases (external links) to run some reports. The coding in any of the 4 is pretty simple. Recently when we make a new .mde for the...
2
by: mdeni | last post by:
I am sorry if this was allready asked or discussed, please redirect me. I have to make the program of postorder traversal of the binary search tree NOT using recursion. I have found many solutinos...
7
by: Mike | last post by:
Type Mismatch error I recieve a type mismatch error on the following line of code which is based on a specific date. It does NOT break on all records only "some". The dates for the records...
19
by: zz12 | last post by:
Hello, is there a setting in IIS 5.0 that would quickly fix the following error?: Microsoft VBScript runtime (0x800A000D) Type mismatch It's strange because some of our .asp pages were...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.