NYQuicksale
asked on
Loop Problem
this code doesn't work when there's just one symbol.
actually this code's purpose is to do the following:
i've sheet which contains too many ticker symbols and whenever one symbol is done, then cut and paste that symbol somewhere else and make that cell blank and goto next symbol, so whenevr i again run the loop, it would start from whatever next populated cell in that column. i hope u get the idea, but this below code doesn't work, when there's just one symbol there in column A
actually this code's purpose is to do the following:
i've sheet which contains too many ticker symbols and whenever one symbol is done, then cut and paste that symbol somewhere else and make that cell blank and goto next symbol, so whenevr i again run the loop, it would start from whatever next populated cell in that column. i hope u get the idea, but this below code doesn't work, when there's just one symbol there in column A
Sub loopC()
Dim cel As Range
Dim mySheet As Worksheet
Set mySheet = Sheets("info")
For Each cel In Sheets("symbols").Range("A" & Sheets("symbols").Range("A1").End(xlDown).Row & ":A" & Sheets("symbols").Range("A1").End(xlDown).End(xlDown).Row)
mySheet.Range("A1") = cel.Value
Next cel
End Sub
Note the difference between this:
mySheet.Range("A1") = cel.Value
And this:
cel.Value = mySheet.Range("A1").Value
mySheet.Range("A1") = cel.Value
And this:
cel.Value = mySheet.Range("A1").Value
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
it has entered into infinite loop
Which solution are you referring to?
ASKER
both
Is your goal to select all the cells in column A that have text?
ASKER
saqib your code is working now, why u didn't give it before? i'm just testing it every perspective, dun want to get into trouble again
Take your time. I am not in a hurry. You could have continued in the previous question and I would have been pleased to assist you.
...why u didn't give it before?
I never imagined you would want to cover "Only one" as well.
Saqib
...why u didn't give it before?
I never imagined you would want to cover "Only one" as well.
Saqib
ASKER
that's by default, it can be from one to one million
Open in new window