#1   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 390
Default Code error

I am using this code (below) and it is giving me an error (Variable not
defined) with the letter A of Serie A highlighted. Any help please?

This is the code:

Option Explicit
Dim nextSecond

Sub startFlashing()
flashCell
End Sub

Sub stopFlashing()
On Error Resume Next
Application.OnTime nextSecond, "flashCell", , False
End Sub

Sub flashCell()
nextSecond = Now + TimeValue("00:00:01")
Application.OnTime nextSecond, "flashCell"


If Range("AN6").Interior.ColorIndex = 3 Then
Serie A.Range("AN6").Interior.ColorIndex = 41
Serie A.Range("AN6").Value = "Light Blue"


ElseIf Range("AN6").Interior.ColorIndex = 41 Then
Serie A.Range("AN6").Interior.ColorIndex = 3
Serie A.Range("AN6").Value = "Pink"

End If

If Range("AW6").Interior.ColorIndex = 3 Then
Serie A.Range("AW6").Interior.ColorIndex = 41
Serie A.Range("AW6").Value = "Light Blue"


ElseIf Range("AW6").Interior.ColorIndex = 41 Then
Serie A.Range("AW6").Interior.ColorIndex = 3
Serie A.Range("AW6").Value = "Pink"


End If
End Sub

Thanks for your help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Code error

You have not referred the workbook and worksheet. If you are trying this out
in your ActiveWorkbook replace

Serie A.Range("AN6")

with

ActiveWorkbook.Sheets("<Sheename").Range("AN6")
(type in the sheename between quotes.)

If this post helps click Yes
---------------
Jacob Skaria


"MAX" wrote:

I am using this code (below) and it is giving me an error (Variable not
defined) with the letter A of Serie A highlighted. Any help please?

This is the code:

Option Explicit
Dim nextSecond

Sub startFlashing()
flashCell
End Sub

Sub stopFlashing()
On Error Resume Next
Application.OnTime nextSecond, "flashCell", , False
End Sub

Sub flashCell()
nextSecond = Now + TimeValue("00:00:01")
Application.OnTime nextSecond, "flashCell"


If Range("AN6").Interior.ColorIndex = 3 Then
Serie A.Range("AN6").Interior.ColorIndex = 41
Serie A.Range("AN6").Value = "Light Blue"


ElseIf Range("AN6").Interior.ColorIndex = 41 Then
Serie A.Range("AN6").Interior.ColorIndex = 3
Serie A.Range("AN6").Value = "Pink"

End If

If Range("AW6").Interior.ColorIndex = 3 Then
Serie A.Range("AW6").Interior.ColorIndex = 41
Serie A.Range("AW6").Value = "Light Blue"


ElseIf Range("AW6").Interior.ColorIndex = 41 Then
Serie A.Range("AW6").Interior.ColorIndex = 3
Serie A.Range("AW6").Value = "Pink"


End If
End Sub

Thanks for your help.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Code error

Adjust Range("B5:Z37") as your requirement..

Sub Macro()
Dim lngRow As Long
Dim intTemp As Integer
Dim arrData(17) As Variant
Range("N2") = Range("N2") + 7
arrData(0) = Range("C37")
For lngRow = 5 To 37 Step 2
intTemp = intTemp + 1
arrData(intTemp) = Range("C" & lngRow)
Range("C" & lngRow) = arrData(intTemp - 1)
Next
Range("C1") = varValue

Range("B5:Z37").ClearContents
Range("B5:Z37").ClearComments
Range("B5:Z37").ClearFormats

End Sub

If this post helps click Yes
---------------
Jacob Skaria


"MAX" wrote:

I am using this code (below) and it is giving me an error (Variable not
defined) with the letter A of Serie A highlighted. Any help please?

This is the code:

Option Explicit
Dim nextSecond

Sub startFlashing()
flashCell
End Sub

Sub stopFlashing()
On Error Resume Next
Application.OnTime nextSecond, "flashCell", , False
End Sub

Sub flashCell()
nextSecond = Now + TimeValue("00:00:01")
Application.OnTime nextSecond, "flashCell"


If Range("AN6").Interior.ColorIndex = 3 Then
Serie A.Range("AN6").Interior.ColorIndex = 41
Serie A.Range("AN6").Value = "Light Blue"


ElseIf Range("AN6").Interior.ColorIndex = 41 Then
Serie A.Range("AN6").Interior.ColorIndex = 3
Serie A.Range("AN6").Value = "Pink"

End If

If Range("AW6").Interior.ColorIndex = 3 Then
Serie A.Range("AW6").Interior.ColorIndex = 41
Serie A.Range("AW6").Value = "Light Blue"


ElseIf Range("AW6").Interior.ColorIndex = 41 Then
Serie A.Range("AW6").Interior.ColorIndex = 3
Serie A.Range("AW6").Value = "Pink"


End If
End Sub

Thanks for your help.

  #5   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 390
Default Code error

Will you please arrange the code for me because I tried it and it is not
working so I thing I am doing something wrong.

Thanks

"MAX" wrote:

I am using this code (below) and it is giving me an error (Variable not
defined) with the letter A of Serie A highlighted. Any help please?

This is the code:

Option Explicit
Dim nextSecond

Sub startFlashing()
flashCell
End Sub

Sub stopFlashing()
On Error Resume Next
Application.OnTime nextSecond, "flashCell", , False
End Sub

Sub flashCell()
nextSecond = Now + TimeValue("00:00:01")
Application.OnTime nextSecond, "flashCell"


If Range("AN6").Interior.ColorIndex = 3 Then
Serie A.Range("AN6").Interior.ColorIndex = 41
Serie A.Range("AN6").Value = "Light Blue"


ElseIf Range("AN6").Interior.ColorIndex = 41 Then
Serie A.Range("AN6").Interior.ColorIndex = 3
Serie A.Range("AN6").Value = "Pink"

End If

If Range("AW6").Interior.ColorIndex = 3 Then
Serie A.Range("AW6").Interior.ColorIndex = 41
Serie A.Range("AW6").Value = "Light Blue"


ElseIf Range("AW6").Interior.ColorIndex = 41 Then
Serie A.Range("AW6").Interior.ColorIndex = 3
Serie A.Range("AW6").Value = "Pink"


End If
End Sub

Thanks for your help.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Code error

Please try this

Option Explicit
Dim nextSecond

Sub startFlashing()
flashCell
End Sub

Sub stopFlashing()
On Error Resume Next
Application.OnTime nextSecond, "flashCell", , False
End Sub

Sub flashCell()
nextSecond = Now + TimeValue("00:00:01")
Application.OnTime nextSecond, "flashCell"

With Sheets("Serie A")
If .Range("AN6").Interior.ColorIndex = 3 Then
.Range("AN6").Interior.ColorIndex = 41
.Range("AN6").Value = "Light Blue"


ElseIf .Range("AN6").Interior.ColorIndex = 41 Then
.Range("AN6").Interior.ColorIndex = 3
.Range("AN6").Value = "Pink"

End If

If .Range("AW6").Interior.ColorIndex = 3 Then
.Range("AW6").Interior.ColorIndex = 41
.Range("AW6").Value = "Light Blue"


ElseIf .Range("AW6").Interior.ColorIndex = 41 Then
.Range("AW6").Interior.ColorIndex = 3
.Range("AW6").Value = "Pink"


End If
End With
End Sub
--
If this post helps click Yes
---------------
Jacob Skaria


"MAX" wrote:

I am using this code (below) and it is giving me an error (Variable not
defined) with the letter A of Serie A highlighted. Any help please?

This is the code:

Option Explicit
Dim nextSecond

Sub startFlashing()
flashCell
End Sub

Sub stopFlashing()
On Error Resume Next
Application.OnTime nextSecond, "flashCell", , False
End Sub

Sub flashCell()
nextSecond = Now + TimeValue("00:00:01")
Application.OnTime nextSecond, "flashCell"


If Range("AN6").Interior.ColorIndex = 3 Then
Serie A.Range("AN6").Interior.ColorIndex = 41
Serie A.Range("AN6").Value = "Light Blue"


ElseIf Range("AN6").Interior.ColorIndex = 41 Then
Serie A.Range("AN6").Interior.ColorIndex = 3
Serie A.Range("AN6").Value = "Pink"

End If

If Range("AW6").Interior.ColorIndex = 3 Then
Serie A.Range("AW6").Interior.ColorIndex = 41
Serie A.Range("AW6").Value = "Light Blue"


ElseIf Range("AW6").Interior.ColorIndex = 41 Then
Serie A.Range("AW6").Interior.ColorIndex = 3
Serie A.Range("AW6").Value = "Pink"


End If
End Sub

Thanks for your help.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Protect Sheet with code, but then code will not Paste error. How do i get around this. Please read for explainations.... Corey Excel Programming 4 November 25th 06 04:57 AM
OnTime code error "can't execute code in break mode" tskogstrom Excel Programming 1 September 8th 06 10:29 AM
Error in Excel VBA Code (Error 91) dailem Excel Programming 1 August 25th 06 03:45 PM
How can I still go to the error-code after a On Error Goto? Michel[_3_] Excel Programming 2 May 4th 04 04:21 AM
Code Error - Run Time Error 5 (Disable Cut, Copy & Paste) Tim[_36_] Excel Programming 4 April 23rd 04 02:53 AM


All times are GMT +1. The time now is 10:04 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"