Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Evaluate does not work

numRows = Selection.CurrentRegion.Rows.Count
myRow = 2 'start below header
Do
For myColumn = 4 To 11 '
With Worksheets("Sheet1")
myArray(1) = .Cells(myRow, 1)
Age = .Cells(myRow, 2)
myArray(2) =
Evaluate("=IF(TRUNC(Age)=0,"""",TRUNC(Age)&"" y,"")&"" "" &ROUND(((Age-
TRUNC(Age))*365)/30,0)&"" mo.""")
myArray(3) = .Cells(myRow, 3)
End With
With Worksheets("Sheet2")
i = i + 1
.Range(.Cells(i, 1), .Cells(i, 3)) = myArray
End With
Next myColumn
myRow = myRow + 1
Loop Until Cells(myRow, 1).Row numRows

The code above runs fine and works in every way reading some junk off
one sheet and writing it to another. The only problem is the
myArray(2) = Evaluate. On the first pass, Age = 37.05 and myArray(2)
correctly evaluates to 37 y, 1 mo. In the next loop Age changes to
17.91 but myArray(2) stays 37 y, 1 mo. and remains that from then on
regardless of what Age is.
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
Evaluate Formula with Named Ranges does not work if Workbook isalready open todtown Excel Programming 1 November 15th 07 07:33 AM
Evaluate Formula with Named Ranges does not work if Workbook isalready open todtown Excel Programming 0 November 15th 07 04:51 AM
Evaluate Formula with Named Ranges does not work if Workbook isalready open todtown Excel Programming 0 November 15th 07 04:51 AM
=EVALUATE("{ to work in a range of cells Fin Fang Foom Excel Worksheet Functions 8 May 9th 07 11:33 PM
Evaluate(Indirect) doesnt work srinu1264[_3_] Excel Programming 1 May 6th 06 02:16 PM


All times are GMT +1. The time now is 06: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"