ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   What's wrong with this code, please? (https://www.excelbanter.com/excel-programming/305873-whats-wrong-code-please.html)

Jim Berglund

What's wrong with this code, please?
 
I have 4 columns with data in them. I first check to see if two cells match.
If so, I want to fill in the value of a cell in a third column with the
corresponding value from a 4th Column. Nothing happens...

For i = 5 To numberofRows
If Cells(i, 111).Value = Cells(12, j).Value Then
Cells(k, j).Value = Cells(i, 112).Value
k = k + 1
End If
Next

Help would be appreciated. BTW, thanks to those who have assisted in
previous requests.

Jim Berglund



Tom Ogilvy

What's wrong with this code, please?
 
Cells(i,111).Value never equals Cells(12,j)

j never gets initialized and you are using On Error Resume Next, so you
never see the error

k is never initialized and you are using On Error Resume Next, so you never
see the error.

Just some possibilities.

--
Regards,
Tom Ogilvy

"Jim Berglund" wrote in message
...
I have 4 columns with data in them. I first check to see if two cells

match.
If so, I want to fill in the value of a cell in a third column with the
corresponding value from a 4th Column. Nothing happens...

For i = 5 To numberofRows
If Cells(i, 111).Value = Cells(12, j).Value Then
Cells(k, j).Value = Cells(i, 112).Value
k = k + 1
End If
Next

Help would be appreciated. BTW, thanks to those who have assisted in
previous requests.

Jim Berglund






All times are GMT +1. The time now is 01:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com