473,411 Members | 1,980 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,411 software developers and data experts.

Compile Error Expected End Sub

I am a novice old timer who enjoys fooling around with excel, I copied this macro from and old computer and wanted to use it one a new one I got.

Its supposed to draw a line across a row when there is a change from one number to another.

When I try to use it I get this error

Compile Error
Expected End Sub

Help please.
Thanks Don






Sub Macro1()
'
' Macro1 Macro
' Macro recorded 8/27/2008 by
'
' Keyboard Shortcut: Ctrl+m

Sub Drawline()
Dim vValue
Do Until ActiveCell = Empty
vValue = ActiveCell
ActiveCell.Offset(1, 0).Activate
If ActiveCell <> vValue Then
Range(ActiveCell, ActiveCell.Offset(0, 35)).Select
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
End If
Loop

End Sub
Nov 9 '08 #1
2 16405
Add an apostrophe ' in front of Sub Macro1()
Nov 9 '08 #2
jg007
283 100+
looking at this you seem to have created a macro and then copied the old macro inside it but you have also copied the start of the sub.

if you start a sub -

Expand|Select|Wrap|Line Numbers
  1. Sub Example_Macro
  2.  
you then need to end that sub -


Expand|Select|Wrap|Line Numbers
  1. End Sub
  2.  
if you record the macro excell will generate a sub for you - 'macro1' in your code, this sub will have a start and end and you have confused excel by starting another sub within that one and not finishing it.

if you add an apostrophe " ' " it comments that line out so if you add the apostrophe before the " sub macro1 " excel will then just use your sub and you will see the macro name will also change to 'drawline'
Nov 9 '08 #3

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

Similar topics

5
by: Carmine Cairo | last post by:
Hi, I'm working on a project and today I've note a little problem during the compile fase. Here a little piece of code: // 1st version welldone = 0; size = p->getSize(); backbone = new...
5
by: cranium.2003 | last post by:
hi, Here is my code #include <iostream.h> int main() { cout <<"HI"; return 0; } and using following command to compile a C++ program g++ ex1.cpp -o ex1
4
by: Eric Lilja | last post by:
Is this an invalid program? Doesn't compile on my system: #include <cstdio> class Why { enum TArch {LITTLE_ENDIAN, BIG_ENDIAN, NON_IEEE}; TArch Architecture; }; int
15
by: key9 | last post by:
Why still can't compile (simple) Hi all I have nothing to say , the code still can not be complie, where's problem? ========================================= //test.cpp #include <stdio.h>...
2
by: donkeyboy | last post by:
All, I've tried the jythonc compiler to try and create an applet to see how it works, but I get a number of Java compile errors that are way above my knowledge. Does anyone know what any of the...
8
by: pagantom | last post by:
Hello. newbie here. need help. here's the text, compile errors are below. thanks class date { private: char *mo; int day, yr; public:
5
by: wong_powah | last post by:
#include <vector> #include <iostream> using std::cout; using std::vector; enum {DATASIZE = 20}; typedef unsigned char data_t;
6
by: liam_herron | last post by:
Any idea why the following code doesn't compile? #include <iostream> #include <vector> class A { public:
9
by: beet | last post by:
Hi, I am really not good at c/c++. Some simple code.. #include <stdio.h> #include <stdlib.h> #include <math.h> #include "simlibdefs.h"
3
by: Hill | last post by:
This is an simple map, just an exercise. Who can help me fix this compile issue?Thanks in advance. #include <string> #include <vector> #include <iostream> using std::vector; using std::string;...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.