Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 116
Default Execute on Cell Change - Problem

Hello, folks:

I'm trying to execute a series of code steps based on changes to ranges of
cells. I have used this code before, but for some reason it's not working
now and I can't spot why.

Basically, I want to change the value of cells in a column AB (28) of my
worksheet if any cell in ranges D8:F1000 or V8:X1000 change.

Here is the code. Can anyone spot anything obvious?

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim myRow&, myCol&
myRow = Target.Row
myCol = Target.Column
If myRow 7 And myRow < 1001 Then
If (myCol 6 And MyCOL < 9) Or _
(myCol 21 And MyCOL < 25) Then

{code steps here, which do a row-by-row evaluation of the contents of the
target ranges and put a string of text (which varies depending upon the
contents of the targets) in the corresponding row in column 28.}

End If 'myCol
End If 'myRow

I commented out the code above and tried it with a command button and it
works fine, so I know the code steps are not the problem.

Thoughts? Thanks in advance.

MARTY
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Execute on Cell Change - Problem

? Range("D1").Column
4
? Range("F1").Column
6

so
If (myCol 6 And MyCOL < 9) Or _


should be
If (myCol 3 And MyCOL < 7) Or _


--
Regards,
Tom Ogilvy

"Marty" wrote in message
...
Hello, folks:

I'm trying to execute a series of code steps based on changes to ranges of
cells. I have used this code before, but for some reason it's not working
now and I can't spot why.

Basically, I want to change the value of cells in a column AB (28) of my
worksheet if any cell in ranges D8:F1000 or V8:X1000 change.

Here is the code. Can anyone spot anything obvious?

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim myRow&, myCol&
myRow = Target.Row
myCol = Target.Column
If myRow 7 And myRow < 1001 Then
If (myCol 6 And MyCOL < 9) Or _
(myCol 21 And MyCOL < 25) Then

{code steps here, which do a row-by-row evaluation of the contents of the
target ranges and put a string of text (which varies depending upon the
contents of the targets) in the corresponding row in column 28.}

End If 'myCol
End If 'myRow

I commented out the code above and tried it with a command button and it
works fine, so I know the code steps are not the problem.

Thoughts? Thanks in advance.

MARTY



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 116
Default Execute on Cell Change - Problem

That did it. Thanks so much, Tom. I figued it was something simple I was
overlooking.

{Note to self: D = 4, D<6 . . .}

"Tom Ogilvy" wrote:

? Range("D1").Column
4
? Range("F1").Column
6

so
If (myCol 6 And MyCOL < 9) Or _


should be
If (myCol 3 And MyCOL < 7) Or _


--
Regards,
Tom Ogilvy

"Marty" wrote in message
...
Hello, folks:

I'm trying to execute a series of code steps based on changes to ranges of
cells. I have used this code before, but for some reason it's not working
now and I can't spot why.

Basically, I want to change the value of cells in a column AB (28) of my
worksheet if any cell in ranges D8:F1000 or V8:X1000 change.

Here is the code. Can anyone spot anything obvious?

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim myRow&, myCol&
myRow = Target.Row
myCol = Target.Column
If myRow 7 And myRow < 1001 Then
If (myCol 6 And MyCOL < 9) Or _
(myCol 21 And MyCOL < 25) Then

{code steps here, which do a row-by-row evaluation of the contents of the
target ranges and put a string of text (which varies depending upon the
contents of the targets) in the corresponding row in column 28.}

End If 'myCol
End If 'myRow

I commented out the code above and tried it with a command button and it
works fine, so I know the code steps are not the problem.

Thoughts? Thanks in advance.

MARTY




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
can i execute a calculation in a cell at a certain time of the day terry Excel Worksheet Functions 2 June 9th 06 04:03 PM
Auto execute a macro if a cell value=1 ? Sven[_6_] Excel Programming 1 November 16th 04 07:25 AM
Auto execute a macro if a cell value=1 ? Sven[_5_] Excel Programming 1 November 15th 04 02:33 PM
Auto execute a macro if a cell value=1 ? Sven[_4_] Excel Programming 1 November 14th 04 11:36 PM
Auto execute a macro if a cell value=1 ? Sven[_2_] Excel Programming 3 May 16th 04 12:06 AM


All times are GMT +1. The time now is 10:23 AM.

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

About Us

"It's about Microsoft Excel"