Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with what is wrong with code
try
Set inputRnge = Sheets("Input Data").cells(1,1).entirecolumn "OssieMac" wrote: If you see this question posted twice then my apologies. Something went wrong before and I can't see it on the forum. I will appreciate help with the following to tell me what I am doing wrong. I have these lines of code which work fine:- Dim c Dim inputRnge As Range Set inputRnge = Sheets("Input Data").Range("A:A") For Each c In inputRnge If c.Value = 0 Then Exit For 'further code here However I want to be able to set inputRnge based on the numeric value of the column which I believe should be like this: Set inputRnge = Sheets("Input Data").Columns(1) inputRnge.Select 'This line for testing inputRnge and it works For Each c In inputRnge If c.Value = 0 Then Exit For 'further code here The second lot of code fails on the line If c.Value = 0 Then Exit For with the error message: Runtime error 13 Type mismatch. Note that the only difference between the two lots of code is the set inputRnge and I have tested the inputRnge with the select which appears to work so what is wrong with it? All help greatly appreciated. Regards, OssieMac |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
What is wrong with the code? | Excel Discussion (Misc queries) | |||
Help with what is wrong with code | Excel Programming | |||
HELP! What's wrong with my code? | Excel Programming | |||
HELP! What's wrong with my code? | Excel Programming | |||
What's wrong with the code,pls hv a look | Excel Programming |