Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
This works but need to extend range
This code works fine, it moves the vale "Brk" from anywhere in a grou
of 8 cells to the begining or end depending on it's placement. However it only works in column G. If it finds "Brk", it needs to b moved to either end regardless of where the 8 cells that contain th value are, the group of 8 cells could be anywhere in the range of G11 CX298 Thanks Dim Rng As Range Dim c As Integer Dim r As Integer Dim x As Integer With ActiveSheet Set Rng = Range("G11:CX30") For c = 1 To Rng.Columns.Count Step 10 For r = 1 To Rng.Rows.Count On Error Resume Next x = WorksheetFunction.Match("Brk", Rng.Range(Cells(r, c) Cells(r, c + 9)), 0) If Err = 0 Then If Rng.Cells(r, c).Value = "IND" Then Select Case x Case 1 To 4 Rng.Cells(r, c - 1).Value = "Brk" Rng.Cells(r, c + x - 1).Value = "IND" Case 5 To 8 c = c + 1 x = x - 1 Rng.Cells(r, c + 7).Value = "Brk" Rng.Cells(r, c + x - 1).Value = "IND" End Select End If Else Err.Clear End If Next r Next c End Wit -- Message posted from http://www.ExcelForum.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to extend the active range | Excel Discussion (Misc queries) | |||
Extend Name range | Excel Discussion (Misc queries) | |||
HOW TO EXTEND A NAMED RANGE | Excel Worksheet Functions | |||
Painting Range - extend the range on the top part | Excel Discussion (Misc queries) | |||
Extend a data range | New Users to Excel |