I searched and came up with practically nothing.
I have a handle on most of what needs modified in the code Stanley helped me with here http://www.ozgrid.com/forum/showthre...960#post515960
However, if there is some advice on what else needs modified to work with XL2010 regarding the code below, I'd appreciate it; it would go far to nudging me in the right direction for modifying the rest of my code for 2 different projects I 'thought' I was close to completing. I would appreciate any advice or commentary on backwards-compatibility as well; if there are issues, I'm just going to make it for XL2010 and get the users upgraded. If there is a reference to 2010 'issues' I could get pointed to, that would be appreciated as well, as I'm not finding much that's very helpful. This is a HUGE step backward for me, given that we have limited XL2007 licenses and loaded up with XL2010 licenses.
Thanks in advance!
JR
Original code submitted by Stanley
VB:
Sub Insert_Blank_RowsV2()
Dim rng As Range, cell As Range, LR As Long
Application.ScreenUpdating = False
LR = Cells(Rows.Count, "A").End(xlUp).Row
Range("A2:N" & LR).Sort Key1:=Range("J2"), Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
Columns("A:B").Insert
[A2] = 1
Columns(12).Copy Columns(2)
Set rng = Range([A3], [B65536].End(xlUp)(1, 0))
With rng
.FormulaR1C1 = "=IF(RC[1]=R[-1]C[1],R[-1]C,R[-1]C+1)"
.Value = .Value
End With
Set cell = [A65536].End(xlUp)
cell(2) = 1
cell(2).DataSeries Rowcol:=xlColumns, Type:=xlLinear, Step:=1, Stop:=cell - 1
Range([A2], [A65536].End(xlUp)).EntireRow.Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlNo
Columns("A:B").Delete
Application.ScreenUpdating = True
End Sub
I got as far as correcting the syntax for XL2010 with this
VB:
Sub Insert_Blank_RowsV2()
Dim rng As Range, cell As Range, LR As Long
Application.ScreenUpdating = False
LR = Cells(Rows.Count, "A").End(xlUp).Row
Range("A2:N" & LR).Sort Key1:=Range("J2"), Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
Columns("A:B").Insert
Range("A2") = 1
Columns(12).Copy Columns(2)
Set rng = Range("A3", "B65536").End(xlUp)(1, 0)
With rng
.FormulaR1C1 = "=IF(RC[1]=R[-1]C[1],R[-1]C,R[-1]C+1)"
.Value = .Value
End With
Set cell = Range("A65536").End(xlUp)
cell(2) = 1
cell(2).DataSeries Rowcol:=xlColumns, Type:=xlLinear, Step:=1, Stop:=cell - 1
Range("A2", "A65536").End(xlUp).EntireRow.Sort Key1:=Range("A2"), Order1:=xlDescending, Header:=xlNo
Columns("A:B").Delete
Application.ScreenUpdating = True
End Sub
(Note: I figured out the brackets are 'out' for 2010 and the basic range formatting that 2010 is anal about, but I'm getting errors [Application-defined or Object-defined 1004 error] here
VB:
Set rng = Range("A3", "B65536").End(xlUp)(1, 0)
I have a feeling it has to do something with this http://support.microsoft.com/kb/244435 . I tried searching this site for references I've read about making code compatible with future releases but could not find anything in a half-dozen passes)
Bookmarks