LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Scanning in reverse order

Hi,

I'm incredibly rusty with VB for macro's, and I'm a little lost here.

With this code, which works, it looks for the names "ServerA", "ServerB" etc
and then formats the cells. But I need to insert 2 rows just above
"ServerNM", but when I do this it gets stuck in a loop as the number of rows
have changed and never gets onto the next ServerNM.
The only way I think I can do this is to start from the bottom of the list,
"LastCell_F".

Is it possible to scan from the bottom of the list or anyone have any ideas
as to how I can insert 2 rows just above every "ServerNM"?

Range("F1000").End(xlUp).Offset(0, 0).Select
LastCell_F = ActiveCell.Row

Dim ServerA As Long
Dim ServerB As Long
Dim ServerC As Long
Dim ServerD As Long
Dim ServerE As Long

For Each ServerNM In Worksheets("Quote").Range("A10:A" & LastCell_F)
ServerA = InStr(1, (ServerNM.Value), "ServerA")
ServerB = InStr(1, (ServerNM.Value), "ServerB")
ServerC = InStr(1, (ServerNM.Value), "ServerC")
ServerD = InStr(1, (ServerNM.Value), "ServerD")
ServerE = InStr(1, (ServerNM.Value), "ServerE")
If ServerA 0 Or ServerB 0 Or ServerC 0 Or ServerD 0 Or ServerE
0 Then
ServerNM.Select
Selection.Font.Bold = True
ServerNM.Offset(0, 2).Select
Selection.Font.Bold = True
Selection.HorizontalAlignment = xlCenter
With Selection.Interior
.ColorIndex = 37
.Pattern = xlSolid
End With

ServerNM.Offset(1, 2).Select
Selection.Font.Italic = True
Selection.Font.Bold = True
ServerNM.Offset(1, 7).Select
With Selection.Interior
.ColorIndex = 0
.Pattern = xlSolid
End With
ServerNM.Offset(0, 7).Select
With Selection.Interior
.ColorIndex = 0
.Pattern = xlSolid
End With
ServerNM.Offset(-1, 7).Select
With Selection.Interior
.ColorIndex = 0
.Pattern = xlSolid
End With
End If
Next ServerNM

Range("A1").Select

End Sub


Hope someone can help,
Thanks
S
 
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
Reverse Order PL Excel Discussion (Misc queries) 3 July 1st 09 05:01 AM
Reverse Order PL Excel Discussion (Misc queries) 1 June 17th 09 02:47 AM
Reverse Order PL Excel Discussion (Misc queries) 2 June 15th 09 09:17 AM
reverse order Lamb Chop Excel Discussion (Misc queries) 2 June 20th 06 03:37 PM
Reverse the order? davegb Excel Programming 2 July 7th 05 09:18 PM


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

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

About Us

"It's about Microsoft Excel"