If...Then Coding Question

FTM

New Member
Joined
Mar 28, 2013
Messages
40
Why doesn't this work:

For i = 17 To FinalRow

'Check for 1750-1...

If ActiveCell.Cells("i, 4") = "1750-1" Then


End If

i = i + 13

Next i

My code is faulting out at the "If ActiveCell.Cells("i, 4") = "1750-1" Then" line. I want the content of the cell at i, 4 to equal 1750-1. The line passes the debugger and faults out on execution.

Thanks for the help.

Regards,

FTM The NOOB!
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Try removing the " " inside the Cell()

If ActiveCell.Cells("i, 4") = "1750-1" Then

Like So...

If ActiveCell.Cells(i, 4) = "1750-1" Then
 
Upvote 0
Maybe this:
For i = 17 to FinalRow Step 13
If Cells(i,4) = "1750-1" Then
'do something here
End If
Next i
 
Upvote 0
Thanks for the "Step" tip, I was wondering about how to incremet i.

The data in the source cell, "1750-1," originates in a pull down list. Is this an issue?

I'm sorry to waste everyone's time. It just occurred to me.

Thanks,

FTM
 
Last edited:
Upvote 0
Thanks for the "Step" tip, I was wondering about how to incremet i.

The data in the source cell, "1750-1," originates in a pull down list. Is this an issue?

I'm sorry to waste everyone's time. It just occurred to me.

Thanks,

FTM
What kind of pull-down list - a validation list, a forms control or an active-x control?
 
Upvote 0
It's a Validation List, I set the list up using the "Data" "Data Validation" tabs on the menu bar.
 
Upvote 0
The line of code that works is, "If Range("D17") = Press Then." Does anyone know how to make the "D" a variable, e.g. an "i."
 
Upvote 0
You've kinda changed tack here....how does the last post relate to the one that JoMo provided an answer to ?
 
Upvote 0

Forum statistics

Threads
1,203,071
Messages
6,053,375
Members
444,658
Latest member
lhollingsworth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top