LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 171
Default Odd macro behavior

Here's a macro that ALMOST works perfectly:

Sub TryNew()
Dim myCount As Integer
Dim myCell As Range
myCount = 0
For Each myCell In Range("E6", Range("E65536").End(xlUp))
If myCell.Value & myCell(1, -2).Value & myCell(1, -1).Value < myCell(2,
1).Value & myCell(2, -2).Value & myCell(2, -1).Value Then
myCell(1, 13).FormulaR1C1 = "=RC[-14] & "", "" & RC[-13]"
myCount = 0
Else
myCount = myCount + 1
End If
Next myCell
End Sub

Rows C, D, and E are the ones referenced in the above. C contains the Last
name, D contains the First name, and E contains a year value (text). I am
writing out the concatenated Last Name, First Name pair into a vacant cell to
the right of other data.

The idea here is that every time there is a change of ANY OF THE THREE
components, the "Then" result fires. And it does -- ALMOST every time.

The one exception is when only the First Name changes. Then "Then" doesn't
fire.

Example:

SMITH JOHN 1999
SMITH JOHN 1999 "Then fires"
SMYTHE JOHN 1999
SMYTHE JOHN 1999 "Then fires"
SMYTHE JANE 1999
SMYTHE JANE 1999 "Then does NOT fire!"

Any ideas what is going on?

--
Dave
Temping with Staffmark
in Rock Hill, SC
 
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
weird macro behavior Dave F Excel Discussion (Misc queries) 0 November 30th 06 03:35 PM
Inconsistent Macro Behavior Sarah K Excel Discussion (Misc queries) 4 November 1st 05 10:36 PM
Inconsistent macro behavior davegb Excel Programming 2 June 21st 05 11:19 PM
Strange macro behavior! davegb Excel Programming 9 May 20th 05 10:50 PM
Macro Random Behavior Otto Moehrbach[_6_] Excel Programming 5 February 16th 04 09:55 PM


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

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"