Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default 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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
range of cells selected when I click on one Cindy Excel Discussion (Misc queries) 0 April 8th 08 08:55 PM
Step through cells in a selected range CLR Excel Programming 0 November 21st 07 05:57 PM
Set Range Using Selected Cells Paputxi Excel Programming 3 May 2nd 06 06:32 PM
Compare a selected Range with a Named range and select cells that do not exist PCLIVE Excel Programming 1 October 18th 05 07:09 PM
max/min of a selected range of cells Srikanth Ganesan[_2_] Excel Programming 1 September 1st 04 10:31 PM


All times are GMT +1. The time now is 06:05 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"