Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The code below fails on this line:
sumRng = ActiveSheet.Range("Y2:Y" & lastYRow) The balloon in the VBE says sumRng =Nothing What am I doing wrong? Sub Math() Dim lastRow As Long Dim c As Variant Dim sh As Worksheet Dim myA As Range Dim lastYRow As Long, sumRng As Range, Tot As Double For Each sh In Worksheets If (sh.Name) < "Sheet1" Then sh.Activate Rows("1:1").Select Selection.Font.Bold = True lastRow = Cells(Rows.Count, "F").End(xlUp).Row For Each c In Range("F2:F" & lastRow) If c.Value < "" Then c.Offset(, 19).Value = "=RC[-17]*RC[-2]" End If Next c lastYRow = Cells(Rows.Count, "Y").End(xlUp).Row sumRng = ActiveSheet.Range("Y2:Y" & lastYRow) Tot = Application.WorksheetFunction.Sum(sumRng) MsgBox Tot ActiveSheet.Rows(lastRow + 1) = Tot Rows("2:2").Select Selection.Delete Shift:=xlUp End If Next sh Sheets("Sheet1").Select End Sub Regards, Ryan--- -- RyGuy |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
show last used cell in a column at the bottom of column. | Excel Worksheet Functions | |||
Finding the bottom non-blank cell in a range | Excel Discussion (Misc queries) | |||
Find value in bottom cell in a column | Excel Programming | |||
Dynamic named list includes blank cell at bottom | Excel Discussion (Misc queries) | |||
dislike jump bottom of column by double-clicking the bottom of cel | Excel Discussion (Misc queries) |