Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I am trying to write a macros program.
How can I get excel to subtract the last numer in a column from the first number in the same column? The range is always different |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Try this UDF:
Function top2bottom(i As Integer) As Double Dim top As Double Dim bot As Double Dim j As Long top = 0 bot = 0 top2bottom = 0 If i 255 Then Exit Function End If For j = 1 To 65536 If Application.IsNumber(Cells(j, i)) Then top = Cells(j, i).Value Exit For End If Next For j = 65536 To 1 Step -1 If Application.IsNumber(Cells(j, i)) Then bot = Cells(j, i).Value Exit For End If Next top2bottom = top - bot End Function For column A use =top2bottom(1) -- Gary''s Student "Steph" wrote: I am trying to write a macros program. How can I get excel to subtract the last numer in a column from the first number in the same column? The range is always different |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel crashes while opening excel file imbeddied with macros | Excel Discussion (Misc queries) | |||
Need Help Initializing Excel Spreadsheet Program | Excel Discussion (Misc queries) | |||
Hyperlink in Excel opens the right program, but can't read file. | Excel Discussion (Misc queries) | |||
Enabling macros | Excel Discussion (Misc queries) | |||
Transferring toolbars and macros to other computers | Excel Discussion (Misc queries) |