View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Die_Another_Day Die_Another_Day is offline
external usenet poster
 
Posts: 644
Default Select multiple rows and apply changes all at once

Try this:

With xlSheet.Range("A" & i & ":E" & i)
.Borders(xlEdgeBottom).LineStyle = xlContinuous
.Borders(xlEdgeBottom).Weight = xlThin
.Borders(xlEdgeBottom).ColorIndex = xlAutomatic
Range(.Offset(-3, 0), .Address).Copy
End With
Range("A" & i + 1 & ":E" & intRow).PasteSpecial _
Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False

That should be extremely efficient. Give it a try and let me know

Charles

JPlankenhorn wrote:
This is actually a Visual Basic 6 program that I am writing, not a
macro. I am not overly familiar with the Excel object model, so I am
not sure what the properties all do. Here is an example of what I am
doing:
For i = 14 To intRow Step 4
With xlSheet.Range(xlSheet.Cells(i, 1), xlSheet.Cells(i, 5))
.Borders(xlEdgeBottom).LineStyle = xlContinuous
.Borders(xlEdgeBottom).Weight = xlThin
.Borders(xlEdgeBottom).ColorIndex = xlAutomatic
End With
Next

What I would like to see is something like:
For i = 14 To intRow Step 4
xlSheet.Row(i).FlagAsSelected
Next

With xlSheet.SelectedRows
.Borders(xlEdgeBottom).LineStyle = xlContinuous
.Borders(xlEdgeBottom).Weight = xlThin
.Borders(xlEdgeBottom).ColorIndex = xlAutomatic
End With

Thanks.


--
JPlankenhorn
------------------------------------------------------------------------
JPlankenhorn's Profile: http://www.excelforum.com/member.php...o&userid=37567
View this thread: http://www.excelforum.com/showthread...hreadid=571974