View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Ken Ken is offline
external usenet poster
 
Posts: 590
Default Macro Error in 2003

Thanks, Tom. I saw you were "on duty" from some previous posts and hoped you
wouild respond.

After more investigation I found that the macro runs okay on some machines
with 2003 and not on others. Leads me to believe that 2003 was not installed
the same - some machines are missing some install options?


"Tom Ogilvy" wrote:

I suspect the either the formula is longer than 1024 characters or Excel
2003 is more demanding and wants you to use Formula on the end of Cells(1,7)

--
Regards,
Tom Ogilvy

"Ken" wrote in message
...
The code below is part of a macro that I wrote in Excel 2000.
When I run it in 2003, it errors out (Application Error) in the last row

of
code.

Any ideas how to fix this? Could it have something to do with add-ins?

Is there a way to re-write the last line to work in 2003?

TIA.

NumRowsTB = Range("A65536").End(xlUp).Row

NumRowsMacro = ThisWorkbook.Sheets(2).Cells(Rows.Count, "A").End(xlUp).Row

NumColsMacro = ThisWorkbook.Sheets(2).Cells(1,
Columns.Count).End(xlToLeft).Column

ColumnID = ThisWorkbook.Sheets(2).Cells(1, NumColsMacro).Address

NormalHomeRng = "[" & ThisWorkbook.Name & "]" &

ThisWorkbook.Sheets(2).Name
& "!$A$1"

NormalColRng = "[" & ThisWorkbook.Name & "]" & ThisWorkbook.Sheets(2).Name

&
"!$B$1:" & ColumnID & ""

NormalRowRng = "[" & ThisWorkbook.Name & "]" & ThisWorkbook.Sheets(2).Name

&
"!$A$2:$A$" & NumRowsMacro & ""

Cells(1, 7) = "=IF(ISERROR(OFFSET(" & NormalHomeRng & ",MATCH(C1," &
NormalRowRng & ",0),MATCH(A1," & NormalColRng & ",0))),"""",OFFSET(" &
NormalHomeRng & ",MATCH(C1," & NormalRowRng & ",0),MATCH(A1," &

NormalColRng
& ",0)))"