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: 177
Default Error Code when compare cells in excel macro

I am trying to compare values on worksheet1 to worksheet2, and copy some of
the data to worksheet3 based upon the if statement results. I've seen a
couple posts discussing what I am trying to do; tried their codes and my own,
and continue to get this error...

"Run-time error €˜1004:

Application-defined or object-defined error"

The "if" line gets highlighted upon macro execution.
-----
Sub correlate()
Dim i, j, k As Integer
For i = 1 To 500 'correlation worksheet
For j = 2 To 11933 'ctsytd05 worksheet
For k = 2 To 14010 'srytd05 worksheet
If Worksheets("srytd05").Cells(4, k).Value =
Worksheets("ctsytd05").Cells(3, j).Value Then
Worksheets("correlation").Cells(1, i - 1).Value =
Worksheets("srytd05").Cells(4, k - 1).Value
Worksheets("correlation").Cells(2, i - 1).Value =
Worksheets("srytd05").Cells(8, k - 1).Value
Worksheets("correlation").Cells(3, i - 1).Value =
Worksheets("ctsytd05").Cells(1, j - 1).Value
End If
Next k
End
Next j
End
Next i
End
End Sub
-------
BTW, I tried reformatting the columns I'm comparing from "General" to
"Number" to no avail. Any suggestions would be greatly appreciated.



 
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
How do I compare cells and if FALSE compare to next cell in EXCEL Cindie Excel Worksheet Functions 0 March 24th 06 05:29 PM
Macro code error; machine dependent SJC Excel Worksheet Functions 4 February 1st 06 04:31 PM
macro to compare multiple cells to determine value macrodummy Excel Worksheet Functions 2 October 9th 05 01:21 PM
In a excel/VB macro I am trying compare cells in different workshe cager Excel Programming 2 July 27th 05 06:29 PM
How do I write a VBA code in excel that will compare two columns . PenelopeinCinci Excel Worksheet Functions 2 April 14th 05 05:27 PM


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