Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Using a user defined functoin to scan data for a number

I am trying to create a check register type spreadsheet, and wanting to use a
UDF,(or if you know another that will work too) to automaticly find the last
balance in the balance colum and return it in the cell at the bottom of the
page. Heres what im trying but it keeps locking up excel when i try to enter
it. I dont know if its the loop or the lack of an argument in the function
line.

Function EOMBal()
Dim a As Single
Range("G45").Select
a = 0
Do While a = 0
If a = 0 Then
ActiveCell.Offset(-1, 0).Select
End If
a = ActiveCell.Value
Loop
EOMBal = a
End Function

Im new to using functions and subs, and new to programing in general so any
advice would be appreaciated.
Thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default Using a user defined functoin to scan data for a number

See replies in .Functions

Biff

"CSUS_CE_Student" wrote in
message ...
I am trying to create a check register type spreadsheet, and wanting to use
a
UDF,(or if you know another that will work too) to automaticly find the
last
balance in the balance colum and return it in the cell at the bottom of
the
page. Heres what im trying but it keeps locking up excel when i try to
enter
it. I dont know if its the loop or the lack of an argument in the
function
line.

Function EOMBal()
Dim a As Single
Range("G45").Select
a = 0
Do While a = 0
If a = 0 Then
ActiveCell.Offset(-1, 0).Select
End If
a = ActiveCell.Value
Loop
EOMBal = a
End Function

Im new to using functions and subs, and new to programing in general so
any
advice would be appreaciated.
Thanks



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default Using a user defined functoin to scan data for a number

Just use this formula

=LOOKUP(2,1/(G1:G45<""),G1:G45)

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"CSUS_CE_Student" wrote in
message ...
I am trying to create a check register type spreadsheet, and wanting to use
a
UDF,(or if you know another that will work too) to automaticly find the
last
balance in the balance colum and return it in the cell at the bottom of
the
page. Heres what im trying but it keeps locking up excel when i try to
enter
it. I dont know if its the loop or the lack of an argument in the
function
line.

Function EOMBal()
Dim a As Single
Range("G45").Select
a = 0
Do While a = 0
If a = 0 Then
ActiveCell.Offset(-1, 0).Select
End If
a = ActiveCell.Value
Loop
EOMBal = a
End Function

Im new to using functions and subs, and new to programing in general so
any
advice would be appreaciated.
Thanks



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 353
Default Using a user defined functoin to scan data for a number

An easier way than UDF for you, maybe:
=INDIRECT("G"&COUNTIF(G2:G45,"0")+1)
counts balances in column G that are above zero, since apparently you have
zeros following your last actual balance. This formula assumes that the
balance range starts in row 2 and is continuous - and there fore adds one to
obtain the actual row number of the latest balance. Adjust as needed.

"CSUS_CE_Student" wrote:

I am trying to create a check register type spreadsheet, and wanting to use a
UDF,(or if you know another that will work too) to automaticly find the last
balance in the balance colum and return it in the cell at the bottom of the
page. Heres what im trying but it keeps locking up excel when i try to enter
it. I dont know if its the loop or the lack of an argument in the function
line.

Function EOMBal()
Dim a As Single
Range("G45").Select
a = 0
Do While a = 0
If a = 0 Then
ActiveCell.Offset(-1, 0).Select
End If
a = ActiveCell.Value
Loop
EOMBal = a
End Function

Im new to using functions and subs, and new to programing in general so any
advice would be appreaciated.
Thanks

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
User Defined Function Barb Reinhardt Excel Worksheet Functions 3 March 28th 07 02:23 AM
User defined charts Ajay Charts and Charting in Excel 0 January 17th 06 12:58 PM
"User-defined type not defined" message in Excel RW1946 Excel Discussion (Misc queries) 0 August 31st 05 12:14 PM
User Defined Variables in MS query cause a problem to import data snb Excel Discussion (Misc queries) 0 April 13th 05 12:16 AM
user defined function row number bj Excel Worksheet Functions 11 March 9th 05 01:31 PM


All times are GMT +1. The time now is 03:19 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"