Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Processing non-contiguous row selections
How do you manage to search through non contiguous... I'm pulling my
hair out on something similar (trying to search the cells in this order: Range("A1:C1,E1:G1,A4:C4,E4:G4,A7:C7,E7:G7,A10:C10 ,E10:G10" and so on) . Can you tell me how you do it, I think that could give me a start tks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Processing non-contiguous row selections
Hi Caméléon,
Try something like: Sub Tester() Dim Rng As Range Dim Ar As Range Dim cell As Range Set Rng = _ Range("A1:C1,E1:G1,A4:C4,E4:G4,A7:C7,E7:G7,A10:C10 ,E10:G10") For Each Ar In Rng.Areas For Each cell In Ar MsgBox "Address: " & cell.Address(0, 0) & vbNewLine _ & "Value = " & cell.Value Next cell Next Ar End Sub -- --- Regards, Norman "Caméléon" wrote in message ups.com... How do you manage to search through non contiguous... I'm pulling my hair out on something similar (trying to search the cells in this order: Range("A1:C1,E1:G1,A4:C4,E4:G4,A7:C7,E7:G7,A10:C10 ,E10:G10" and so on) . Can you tell me how you do it, I think that could give me a start tks |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Processing non-contiguous row selections
Hi Caméléon,
It is unnecessary to iterate through the areas so, more simply: Sub Tester2() Dim Rng As Range Dim cell As Range Set Rng = _ Range("A1:C1,E1:G1,A4:C4,E4:G4,A7:C7,E7:G7,A10:C10 ,E10:G10") For Each cell In Rng MsgBox "Address: " & cell.Address(0, 0) & vbNewLine _ & "Value = " & cell.Value Next cell End Sub --- Regards, Norman "Norman Jones" wrote in message ... Hi Caméléon, Try something like: Sub Tester() Dim Rng As Range Dim Ar As Range Dim cell As Range Set Rng = _ Range("A1:C1,E1:G1,A4:C4,E4:G4,A7:C7,E7:G7,A10:C10 ,E10:G10") For Each Ar In Rng.Areas For Each cell In Ar MsgBox "Address: " & cell.Address(0, 0) & vbNewLine _ & "Value = " & cell.Value Next cell Next Ar End Sub -- --- Regards, Norman "Caméléon" wrote in message ups.com... How do you manage to search through non contiguous... I'm pulling my hair out on something similar (trying to search the cells in this order: Range("A1:C1,E1:G1,A4:C4,E4:G4,A7:C7,E7:G7,A10:C10 ,E10:G10" and so on) . Can you tell me how you do it, I think that could give me a start tks |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Processing non-contiguous row selections
Norman Jones wrote:
Hi Caméléon, Try something like: Sub Tester() Dim Rng As Range Dim Ar As Range Dim cell As Range Set Rng = _ Range("A1:C1,E1:G1,A4:C4,E4:G4,A7:C7,E7:G7,A10:C10 ,E10:G10") For Each Ar In Rng.Areas For Each cell In Ar MsgBox "Address: " & cell.Address(0, 0) & vbNewLine _ & "Value = " & cell.Value Next cell Next Ar End Sub Or perhaps just a single loop: For Each iCell in Rng .. . . Alan Beban |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Processing non-contiguous row selections
Hi Alan,
Or perhaps just a single loop Yes, as acknowledged in my second post: "It is unnecessary to iterate through the areas so, more simply: ...." --- Regards, Norman "Alan Beban" wrote in message ... Or perhaps just a single loop: For Each iCell in Rng . . . Alan Beban |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
excel processing | Excel Worksheet Functions | |||
Processing Data | Excel Worksheet Functions | |||
data processing | Excel Discussion (Misc queries) | |||
Conditional Processing | Excel Discussion (Misc queries) | |||
Data Processing | Excel Programming |