Hi all,
I'm trying to loop thru a range of cells and subtract 48 from each cell total in range set by the counter.
I keep hitting a App defined error..can some one see what is wrong with my code...OR is there another way to subtract from a set range?
Thanks
Public Function LastRow()
Dim lRow As Long
If WorksheetFunction.CountA(Cells) > 0 Then
lRow = Cells.Find(What:="*", After:=[A1], _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row
LastRow = lRow
End If
End Function
Public Sub do_the_volts()
Dim I As Integer, Xrange As Range, sheetname As String, n As Integer
sheetname = ActiveSheet.Name
I = LastRow
Debug.Print I
With Worksheets(sheetname)
Set Xrange = .Range("F2")
End With
Do Until I = 0
n = n - 1
With Xrange
.Cells(n, 0) = .Value - 48#
End With
Loop
End Sub



