Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
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
How to extend the active range Peter[_9_] Excel Discussion (Misc queries) 0 March 29th 09 06:39 PM
Extend Name range alex514 Excel Discussion (Misc queries) 2 February 22nd 08 05:32 PM
HOW TO EXTEND A NAMED RANGE ramana Excel Worksheet Functions 5 October 26th 05 08:53 AM
Painting Range - extend the range on the top part Shrikant Excel Discussion (Misc queries) 4 September 1st 05 11:18 AM
Extend a data range MNicholas New Users to Excel 2 August 22nd 05 09:02 PM


All times are GMT +1. The time now is 11:40 PM.

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"