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

Program works when programmed, but when re opening Excel I get a Compile Error: Expec

Formula as follows... i am not sure what is causing the error... sorry for breaking rule 3.

Sub COLOR()
Sub Worksheet_Change(ByVal Target As Excel.Range)
If Intersect(Target, Range("AH6:AH55000")) Is Nothing Then
Exit Sub
Else
DidCellsChange
End If
End Sub

Sub DidCellsChange()
Dim KeyCells As String
' Define which cells should trigger the KeyCellsChanged macro.
KeyCells = "AH6:AH55000"

' If the Activecell is one of the key cells, call the
' KeyCellsChanged macro.
If Not Application.Intersect(ActiveCell, Range(KeyCells)) _
Is Nothing Then KeyCellsChanged

End Sub

Sub KeyCellsChanged()
Dim Cell As Object

For Each Cell In Range("AH6:AH55000")

If Cell = "AH" Then

' Make the background color of the cell the 3rd color on the
' current palette.
ElseIf Cell = "DISCARD" Then
Cell.EntireRow.Interior.ColorIndex = 3
ElseIf Cell = "" Then
' Otherwise, set the background to none (default).
Cell.EntireRow.Interior.ColorIndex = xlNone

End If

Next Cell

End Sub
May 12 '12 #1
2 1564
You arnt running the program when the excel file is open are you? If you are then the reader of the excel file will fail because someone else (you) have the file opened somewhere else.
May 14 '12 #2
Killer42
8,435 Expert 8TB
What are the details of the error? All that made it into the title is "Expec".
May 22 '12 #3

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

Similar topics

1
by: Tony Johansson | last post by:
Hello! I get compile error when compiling using the command javac from the command terminal window(CMD). I have just two classes which are called HelloWorld.java and Slask.java. I have both...
0
by: Tony Johansson | last post by:
Hello! I get compile error when compiling using the command javac from the command terminal window(CMD). I have just two classes which are called HelloWorld.java and Slask.java. I have both...
2
by: Tony Johansson | last post by:
Hello! I get compile error when compiling using the command javac from the command terminal window(CMD). I have just two classes which are called HelloWorld.java and Slask.java. I have both...
2
by: Frank Vanris | last post by:
Hi, I am using boost which uses templates heavily. When I make a typo the compiler complains, but it complains in the boost headerfile (I attached an example at the end where I forgot to pass in...
2
by: xhenxhe | last post by:
I don't some Excel automation. I've created a program that opens and Excel template and inputs information to it. It runs great on my machine. When I build and deploy I have a user that keep...
0
by: manontheedge | last post by:
I have a program in VB6 that gets data from an internet site, puts it in excel, then opens that excel sheet. It works, but only because I'm throwing an exception and ignoring the error that keeps...
1
by: Bob | last post by:
Hi all, I've created a database at work and have copied it to home but have had some problems when I try to open the main form. The error when I run it is: Compile error: Can't find project...
7
by: MIkeC | last post by:
I am trying to open a specific Excel speadsheet so that I can load to a table. I am using VB6 in Citrix. The code works OK when run locally but simply closes down the application without a...
16
by: Phil Stanton | last post by:
I have a form with a button which is supposed to open an Excel file (With lots of Macros /VBA) in it. The Excel file gets it's data from the Access program Here is the code Private Sub...
5
by: mwhit74 | last post by:
here is the code: // holidays.cpp // Finds a holiday for a specified date from a list of holidays. const int MAX_DATES = 60, // Max number of holidays in list MAX_NAME_LEN = 81; ...
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: 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
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.