Prev: I need to change from "=E7" to (equals the current value of E7)
Next: Can you write VBA to export objects
From: FIRSTROUNDKO via OfficeKB.com on 25 Feb 2010 07:12 Hi, I selected this range Range(ActiveCell.Offset(-lastrow + 2, 0), ActiveCell.Offset(-2, 0)) and I want to put its Sum 2 cells down my code so far is Dim lastrow As Long lastrow = Cells(Rows.Count, 1).End(xlUp).Row Range("B" & lastrow + 2).Select Do Until Selection.Offset(-38, 0) = "" Range(ActiveCell.Offset(-lastrow + 2, 0), ActiveCell.Offset(-2, 0)) Selection.Offset(0, 1).Select Loop -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.aspx/excel-programming/201002/1
From: FIRSTROUNDKO via OfficeKB.com on 25 Feb 2010 08:08
I solved it! Dim uprow As Double Dim lastrow As Long lastrow = Cells(Rows.Count, 1).End(xlUp).Row uprow = lastrow - 2 Range("B" & lastrow + 2).Select Do Until Selection.Offset(-38, 0) = "" ActiveCell.FormulaR1C1 = "=SUM(R[-" & uprow & "]C:R[-2]C)" Selection.Offset(0, 1).Select Loop FIRSTROUNDKO wrote: >Hi, > >I selected this range > >Range(ActiveCell.Offset(-lastrow + 2, 0), ActiveCell.Offset(-2, 0)) > >and I want to put its Sum 2 cells down > >my code so far is > >Dim lastrow As Long >lastrow = Cells(Rows.Count, 1).End(xlUp).Row > >Range("B" & lastrow + 2).Select > >Do Until Selection.Offset(-38, 0) = "" > >Range(ActiveCell.Offset(-lastrow + 2, 0), ActiveCell.Offset(-2, 0)) > >Selection.Offset(0, 1).Select > >Loop -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.aspx/excel-programming/201002/1 |