Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 390
Default Inserting blanks

In , Dallman Ross <dman@localhost.
spake thusly:

Okay, this took me a bit of effort to get to work, because I'm
struggling with my low-intermediate knowledge of VBA (up from
plain "low" a month or so ago). But this (below) works, though it's
a bit slow. Anybody see a way to improve it?

Also, a more specific question: you can see where I have to
remove 3 lines from my iLastRow calculation. That's because the
data ends and then has some extraneous matter below after a
blank line. I'd rather just count from the top row down until the
blank line, but am not sure how to do that.


This group has been tremendous help, btw. I scan things when
I have time and slowly build up a repertoire of insight and
tricks.

This is just a stub of what will be much longer. I'm building
it bit-by-bit.

=====
Sub wsMakeRG()

Dim i, iLastRow, iLastCol, xtraRows As Long

ThisWorkbook.Sheets(1).Activate
ActiveSheet.UsedRange.FormatConditions.Delete
Range("A1").Select
Selection.QueryTable.Refresh BackgroundQuery:=False

xtraRows = 3 '// extraneous rowcount
iLastRow = Cells(Rows.Count, "C").End(xlUp).Row - xtraRows
iLastCol = Cells(1, Columns.Count).End(xlToLeft).Column
Debug.Print iLastRow, iLastCol


With Range("A1", Cells(iLastRow, iLastCol)).Select
Call sortRg '// preferrential sort
Call cfDeltaRows '// CF blue bottom border when data shifts
End With

For i = iLastRow - 1 To 2 Step -1 '// insert row when data shifts
Debug.Print i
If Cells(i, "A") < Cells(i + 1, "A") Then
Rows(i + 1).Insert Shift:=xlDown
End If
Next

End Sub


========================
In , JE
McGimpsey spake thusly:

What's the condition in the CF?

Use the same condition to check your cells/rows


Ah, but the CF uses Excel formulas -- =$A2<$A3 -- but
I want to insert new rows now in a macro and don't -- oh,
I see what you're saying. I was thinking I needed to look
for the blue line, but I can just look for $A2<$A3 in the
macro too. Okay, good. Still, is there a faster way than
iterating through all the rows?

=dman=

In article ,
Dallman Ross <dman@localhost. wrote:

I'd like to insert a blank row below any row where the
conditional-format bottom border in the range is dark blue (code
5). Help appreciated.

=dman=

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
Inserting "true" blanks with functions bearspa Excel Worksheet Functions 5 August 3rd 09 07:54 PM
Inserting Function blanks adjoioning cell Dave Excel Worksheet Functions 4 July 16th 08 04:28 PM
copy range of cells with blanks then paste without blanks justaguyfromky Excel Programming 5 September 3rd 06 11:23 PM
Inserting blanks or changing dimensions Jones Excel Worksheet Functions 1 June 6th 06 01:50 PM
Paste Special Skip Blanks not skipping blanks, but overwriting... gsrosin Excel Discussion (Misc queries) 0 February 22nd 05 03:33 AM


All times are GMT +1. The time now is 11:51 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"