-
Solved: What am I doing Wrong in this simple Code?
I want to check the contents of each cell in "Output" and if there is a "c" in a cell and the corresponding cell in "Cold CI ISX" is NOT BLANK, then to message box the cell indices.
But it is message boxong Every cell starting at (1,1)
[vba]Sub CheckCopyPaste()
Dim i, j As Integer
For i = 1 To 25
For j = 1 To 50
If (Worksheets(2).Cells(i, j) = "c" & Worksheets(3).Cells(i, j) <> "") Then
MsgBox "There is a Problem in Cell " & i & ", " & j
End If
Next j
Next i
End Sub
[/vba]
-
Saladsamurai,
Try:
[VBA]
Option Explicit
Sub CheckCopyPaste()
Dim i As Long, j As Long
For i = 1 To 25
For j = 1 To 50
If Worksheets(2).Cells(i, j) = "c" And Worksheets(3).Cells(i, j) <> "" Then
MsgBox "There is a Problem in Cell " & i & ", " & j
End If
Next j
Next i
End Sub
[/VBA]
Have a great day,
Stan
-
HA! Thanks Stan!! Maybe it's MATLAB that uses "&" or C++...I can't keep them straight!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules