S
Scottmk
First of all, I would like to explain what I am trying to do. I hav
Many columns of data, with a blank column set up next to each one.
was scanning the data for empty cells and placing "-" in the colum
next to empty, if not empty, placing the value instead. Then, it wen
back and deleted all of the old columns. I did a record macro. Now
my problem is my data is longer (in terms of rows) and the macro is n
good. The code looks insane, with all kinds of scrolls in it. Coul
someone look at the code and give some advice on making it simpler?
Thank you
ActiveCell.FormulaR1C1 = "=IF(RC[-1]=0,""-"",RC[-1])"
Range("D2").Select
Selection.AutoFill Destination:=Range("D2157")
Range("D2157").Select
Range("D2").Select
Selection.Copy
Range("F2").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.AutoFill Destination:=Range("F2:F157")
Range("F2:F157").Select
Range("F2").Select
Selection.Copy
Range("H2").Select
ActiveSheet.Paste
Range("J2").Select
ActiveSheet.Paste
ActiveWindow.SmallScroll ToRight:=5
Range("L2").Select
ActiveSheet.Paste
Range("N2").Select
ActiveSheet.Paste
ActiveWindow.SmallScroll ToRight:=4
Range("P2").Select
ActiveSheet.Paste
Range("R2").Select
ActiveSheet.Paste
ActiveWindow.SmallScroll ToRight:=4
Range("T2").Select
ActiveSheet.Paste
Range("V2").Select
ActiveSheet.Paste
ActiveWindow.SmallScroll ToRight:=5
Range("X2").Select
ActiveSheet.Paste
Range("Z2").Select
ActiveSheet.Paste
Range("AB2").Select
ActiveSheet.Paste
ActiveWindow.SmallScroll ToRight:=3
Range("AD2").Select
ActiveSheet.Paste
Range("AF2").Select
ActiveSheet.Paste
Range("AH2").Select
ActiveSheet.Paste
ActiveWindow.SmallScroll ToRight:=4
Range("AJ2").Select
ActiveSheet.Paste
Range("AL2").Select
ActiveSheet.Paste
Range("AM37").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "-0.839999973773956"
Range("AL2").Select
Selection.Copy
Range("AN2").Select
ActiveSheet.Paste
ActiveWindow.SmallScroll ToRight:=2
Range("AP2").Select
ActiveSheet.Paste
Range("AR2").Select
ActiveSheet.Paste
Range("AT2").Select
ActiveSheet.Paste
ActiveWindow.ScrollColumn = 37
ActiveWindow.ScrollColumn = 36
ActiveWindow.ScrollColumn = 35
ActiveWindow.ScrollColumn = 34
ActiveWindow.ScrollColumn = 33
ActiveWindow.ScrollColumn = 32
ActiveWindow.ScrollColumn = 31
ActiveWindow.ScrollColumn = 30
ActiveWindow.ScrollColumn = 29
ActiveWindow.ScrollColumn = 28
ActiveWindow.ScrollColumn = 27
ActiveWindow.ScrollColumn = 26
ActiveWindow.ScrollColumn = 25
ActiveWindow.ScrollColumn = 24
ActiveWindow.ScrollColumn = 23
ActiveWindow.ScrollColumn = 22
ActiveWindow.ScrollColumn = 21
ActiveWindow.ScrollColumn = 20
ActiveWindow.ScrollColumn = 19
ActiveWindow.ScrollColumn = 18
ActiveWindow.ScrollColumn = 17
ActiveWindow.ScrollColumn = 16
ActiveWindow.ScrollColumn = 15
ActiveWindow.ScrollColumn = 14
ActiveWindow.ScrollColumn = 13
ActiveWindow.ScrollColumn = 12
ActiveWindow.ScrollColumn = 11
ActiveWindow.ScrollColumn = 10
ActiveWindow.ScrollColumn = 9
ActiveWindow.ScrollColumn = 8
ActiveWindow.ScrollColumn = 7
ActiveWindow.ScrollColumn = 6
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
ActiveWindow.SmallScroll Down:=-15
Range("H2").Select
Application.CutCopyMode = False
Selection.AutoFill Destination:=Range("H2:H157")
Range("H2:H157").Select
Range("J2").Select
Selection.AutoFill Destination:=Range("J2:J157")
Range("J2:J157").Select
ActiveWindow.SmallScroll ToRight:=3
Range("L2").Select
Selection.AutoFill Destination:=Range("L2:L157")
Range("L2:L157").Select
ActiveWindow.SmallScroll ToRight:=3
Range("N2").Select
Selection.AutoFill Destination:=Range("N2:N157")
Range("N2:N157").Select
ActiveWindow.SmallScroll ToRight:=4
Range("P2").Select
Selection.AutoFill Destination:=Range("P2157")
Range("P2157").Select
Range("R2").Select
Selection.AutoFill Destination:=Range("R2:R157")
Range("R2:R157").Select
Range("T2").Select
Selection.AutoFill Destination:=Range("T2:T157")
Range("T2:T157").Select
ActiveWindow.SmallScroll ToRight:=5
Range("V2").Select
Selection.AutoFill Destination:=Range("V2:V157")
Range("V2:V157").Select
Range("X2").Select
Selection.AutoFill Destination:=Range("X2:X157")
Range("X2:X157").Select
ActiveWindow.SmallScroll ToRight:=4
Range("Z2").Select
Selection.AutoFill Destination:=Range("Z2:Z157")
Range("Z2:Z157").Select
Range("AB2").Select
Selection.AutoFill Destination:=Range("AB2:AB157")
Range("AB2:AB157").Select
ActiveWindow.SmallScroll ToRight:=5
Range("AD2").Select
Selection.AutoFill Destination:=Range("AD2:AD157")
Range("AD2:AD157").Select
Range("AF2").Select
Selection.AutoFill Destination:=Range("AF2:AF157")
Range("AF2:AF157").Select
Range("AH2").Select
ActiveWindow.SmallScroll ToRight:=3
Selection.AutoFill Destination:=Range("AH2:AH157")
Range("AH2:AH157").Select
Range("AJ2").Select
Selection.AutoFill Destination:=Range("AJ2:AJ157")
Range("AJ2:AJ157").Select
ActiveWindow.SmallScroll ToRight:=4
Range("AL2").Select
Selection.AutoFill Destination:=Range("AL2:AL157")
Range("AL2:AL157").Select
Range("AN2").Select
Selection.AutoFill Destination:=Range("AN2:AN157")
Range("AN2:AN157").Select
ActiveWindow.SmallScroll ToRight:=4
Range("AP2").Select
Selection.AutoFill Destination:=Range("AP2:AP157")
Range("AP2:AP157").Select
Range("AR2").Select
Selection.AutoFill Destination:=Range("AR2:AR157")
Range("AR2:AR157").Select
Range("AT2").Select
Selection.AutoFill Destination:=Range("AT2:AT157")
Range("AT2:AT157").Select
Many columns of data, with a blank column set up next to each one.
was scanning the data for empty cells and placing "-" in the colum
next to empty, if not empty, placing the value instead. Then, it wen
back and deleted all of the old columns. I did a record macro. Now
my problem is my data is longer (in terms of rows) and the macro is n
good. The code looks insane, with all kinds of scrolls in it. Coul
someone look at the code and give some advice on making it simpler?
Thank you
ActiveCell.FormulaR1C1 = "=IF(RC[-1]=0,""-"",RC[-1])"
Range("D2").Select
Selection.AutoFill Destination:=Range("D2157")
Range("D2157").Select
Range("D2").Select
Selection.Copy
Range("F2").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.AutoFill Destination:=Range("F2:F157")
Range("F2:F157").Select
Range("F2").Select
Selection.Copy
Range("H2").Select
ActiveSheet.Paste
Range("J2").Select
ActiveSheet.Paste
ActiveWindow.SmallScroll ToRight:=5
Range("L2").Select
ActiveSheet.Paste
Range("N2").Select
ActiveSheet.Paste
ActiveWindow.SmallScroll ToRight:=4
Range("P2").Select
ActiveSheet.Paste
Range("R2").Select
ActiveSheet.Paste
ActiveWindow.SmallScroll ToRight:=4
Range("T2").Select
ActiveSheet.Paste
Range("V2").Select
ActiveSheet.Paste
ActiveWindow.SmallScroll ToRight:=5
Range("X2").Select
ActiveSheet.Paste
Range("Z2").Select
ActiveSheet.Paste
Range("AB2").Select
ActiveSheet.Paste
ActiveWindow.SmallScroll ToRight:=3
Range("AD2").Select
ActiveSheet.Paste
Range("AF2").Select
ActiveSheet.Paste
Range("AH2").Select
ActiveSheet.Paste
ActiveWindow.SmallScroll ToRight:=4
Range("AJ2").Select
ActiveSheet.Paste
Range("AL2").Select
ActiveSheet.Paste
Range("AM37").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "-0.839999973773956"
Range("AL2").Select
Selection.Copy
Range("AN2").Select
ActiveSheet.Paste
ActiveWindow.SmallScroll ToRight:=2
Range("AP2").Select
ActiveSheet.Paste
Range("AR2").Select
ActiveSheet.Paste
Range("AT2").Select
ActiveSheet.Paste
ActiveWindow.ScrollColumn = 37
ActiveWindow.ScrollColumn = 36
ActiveWindow.ScrollColumn = 35
ActiveWindow.ScrollColumn = 34
ActiveWindow.ScrollColumn = 33
ActiveWindow.ScrollColumn = 32
ActiveWindow.ScrollColumn = 31
ActiveWindow.ScrollColumn = 30
ActiveWindow.ScrollColumn = 29
ActiveWindow.ScrollColumn = 28
ActiveWindow.ScrollColumn = 27
ActiveWindow.ScrollColumn = 26
ActiveWindow.ScrollColumn = 25
ActiveWindow.ScrollColumn = 24
ActiveWindow.ScrollColumn = 23
ActiveWindow.ScrollColumn = 22
ActiveWindow.ScrollColumn = 21
ActiveWindow.ScrollColumn = 20
ActiveWindow.ScrollColumn = 19
ActiveWindow.ScrollColumn = 18
ActiveWindow.ScrollColumn = 17
ActiveWindow.ScrollColumn = 16
ActiveWindow.ScrollColumn = 15
ActiveWindow.ScrollColumn = 14
ActiveWindow.ScrollColumn = 13
ActiveWindow.ScrollColumn = 12
ActiveWindow.ScrollColumn = 11
ActiveWindow.ScrollColumn = 10
ActiveWindow.ScrollColumn = 9
ActiveWindow.ScrollColumn = 8
ActiveWindow.ScrollColumn = 7
ActiveWindow.ScrollColumn = 6
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
ActiveWindow.SmallScroll Down:=-15
Range("H2").Select
Application.CutCopyMode = False
Selection.AutoFill Destination:=Range("H2:H157")
Range("H2:H157").Select
Range("J2").Select
Selection.AutoFill Destination:=Range("J2:J157")
Range("J2:J157").Select
ActiveWindow.SmallScroll ToRight:=3
Range("L2").Select
Selection.AutoFill Destination:=Range("L2:L157")
Range("L2:L157").Select
ActiveWindow.SmallScroll ToRight:=3
Range("N2").Select
Selection.AutoFill Destination:=Range("N2:N157")
Range("N2:N157").Select
ActiveWindow.SmallScroll ToRight:=4
Range("P2").Select
Selection.AutoFill Destination:=Range("P2157")
Range("P2157").Select
Range("R2").Select
Selection.AutoFill Destination:=Range("R2:R157")
Range("R2:R157").Select
Range("T2").Select
Selection.AutoFill Destination:=Range("T2:T157")
Range("T2:T157").Select
ActiveWindow.SmallScroll ToRight:=5
Range("V2").Select
Selection.AutoFill Destination:=Range("V2:V157")
Range("V2:V157").Select
Range("X2").Select
Selection.AutoFill Destination:=Range("X2:X157")
Range("X2:X157").Select
ActiveWindow.SmallScroll ToRight:=4
Range("Z2").Select
Selection.AutoFill Destination:=Range("Z2:Z157")
Range("Z2:Z157").Select
Range("AB2").Select
Selection.AutoFill Destination:=Range("AB2:AB157")
Range("AB2:AB157").Select
ActiveWindow.SmallScroll ToRight:=5
Range("AD2").Select
Selection.AutoFill Destination:=Range("AD2:AD157")
Range("AD2:AD157").Select
Range("AF2").Select
Selection.AutoFill Destination:=Range("AF2:AF157")
Range("AF2:AF157").Select
Range("AH2").Select
ActiveWindow.SmallScroll ToRight:=3
Selection.AutoFill Destination:=Range("AH2:AH157")
Range("AH2:AH157").Select
Range("AJ2").Select
Selection.AutoFill Destination:=Range("AJ2:AJ157")
Range("AJ2:AJ157").Select
ActiveWindow.SmallScroll ToRight:=4
Range("AL2").Select
Selection.AutoFill Destination:=Range("AL2:AL157")
Range("AL2:AL157").Select
Range("AN2").Select
Selection.AutoFill Destination:=Range("AN2:AN157")
Range("AN2:AN157").Select
ActiveWindow.SmallScroll ToRight:=4
Range("AP2").Select
Selection.AutoFill Destination:=Range("AP2:AP157")
Range("AP2:AP157").Select
Range("AR2").Select
Selection.AutoFill Destination:=Range("AR2:AR157")
Range("AR2:AR157").Select
Range("AT2").Select
Selection.AutoFill Destination:=Range("AT2:AT157")
Range("AT2:AT157").Select