Step through cells in a selected range
Hi Hemant_india.....
Your code didn't work directly for me, (I forgot to mention I'm using XL97),
but this slight modification of it did work fine..........
Sub XX_CellsInRng()
Dim rng As Range
Dim cll As Range
Set rng = Selection
For Each cll In rng
If IsNumeric(cll.Value) Then
If cll.Value < 1000 And cll.Value < "" Then
cll.Value = 1001
End If
End If
Next cll
End Sub
Thanks very much for heading me in the right direction.
Vaya con Dios,
Chuck, CABGx3
"Hemant_india" wrote:
hi
see if this works
Sub XX_CellsInRng()
Dim rng As Range
Dim cll As Range
Set rng = Selection
For Each cll In rng
if not istext(cll.text) then
If cll.Value < 1000 And cll.Value < "" Then
cll.Value = 1001
End If
end if
Next cll
End Sub
--
hemu
"CLR" wrote:
Hi Ed...........
This works great, much thanks...... but one more favor if you please........
Sub XX_CellsInRng()
Dim rng As Range
Dim cll As Range
Set rng = Selection
For Each cll In rng
If cll.Value < 1000 And cll.Value < "" Then
cll.Value = 1001
End If
Next cll
End Sub
How can I specifically exclude a cell containing TEXT from the cll.value test?
Vaya con Dios,
Chuck, CABGx3
"Ed from AZ" wrote:
Sub XX_CellsInRng()
Dim rng As Range
Dim cll As Range
Set rng = Selection
For Each cll In rng
Debug.Print cll.Value
Next cll
End Sub
Cheers!
Ed
On Nov 21, 9:31 am, CLR wrote:
Hi All.......
I can step through the cells in a column ok, but need help now in stepping
through all the cells in a selected RANGE, (say C3:e7), and perform a task
against each cell.
Any help would be much appreciated.
Vaya con Dios,
Chuck, CABGx3
|