joey peanuts
New Member
- Joined
- Mar 20, 2011
- Messages
- 18
This code is changing the scope of my named ranges. On this worksheet, I want on the ranges to go from $A$9:$A$60 as an example. When this code runs, the .cut part of it is reducing the height of the ranges each time through.
Is there a way to keep this from happening or to redefine the range scopes?
Thank you
HTML:
'if there are empty rows, move all the rows up to fill them
Dim isEMPTY As Boolean, startempty As String
isEMPTY = False
For Each cell In Worksheets("RBA_RECT").Range("A9:A60").Cells
If cell.Value = "" Then
'only need to know where the empty block starts
If isEMPTY = False Then
startempty = cell.Address
isEMPTY = True
End If
Else
'only make changes if we are now on a row that has data and we previously found an empty cell
If startempty <> "" Then
Range(cell.Address, "DA60").Cut Range(startempty)
'reset startempty for the next one
startempty = ""
End If
End If
Next cell
Is there a way to keep this from happening or to redefine the range scopes?
Thank you