Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Reading the row number with VBA


Hi Everyone
I have a little UDF that will look for a value in a row and then retur
the value next to it.
It works well but I need to supply the row number on which the functio
resides as an input parameter. There MUST be a way te read the ro
number automatically. Something like getrow() or whatever.
Any sugestions would be appreciated

--
johan@durba
-----------------------------------------------------------------------
johan@durban's Profile: http://www.excelforum.com/member.php...fo&userid=3426
View this thread: http://www.excelforum.com/showthread.php?threadid=54057

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Reading the row number with VBA

Hi Johan,

Show your UDF code.

More generally, use the Row property which returns the (first) row number of
the range.


---
Regards,
Norman



"johan@durban"
wrote in message
...

Hi Everyone
I have a little UDF that will look for a value in a row and then return
the value next to it.
It works well but I need to supply the row number on which the function
resides as an input parameter. There MUST be a way te read the row
number automatically. Something like getrow() or whatever.
Any sugestions would be appreciated.


--
johan@durban
------------------------------------------------------------------------
johan@durban's Profile:
http://www.excelforum.com/member.php...o&userid=34266
View this thread: http://www.excelforum.com/showthread...hreadid=540570



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default Reading the row number with VBA

Hi Johan,

see help for caller property

Regards,
Ivan

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default Reading the row number with VBA

Not sure what your function does, but

Function gd()
gd = ActiveCell.row

End Function


returns the row number of the active cell at the time the value is
entered - possibly a little unsafe as for example you can't autofill it

  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Reading the row number with VBA


Hi everyone
That was wonderful response in such a short time.
I am now exploring rather using a range but I am going to try this
caller thing first.
Here is my code:


Code:
--------------------
Function linelookup(find_val As String, c1 As String, c2 As String, cur_row As Long) As String
myrange = c1 & cur_row
startcol = Sheets(1).Range(myrange).Column
myrange = c2 & 1
endcol = Sheets(1).Range(myrange).Column
For i = startcol To endcol
If Sheets(1).Cells(cur_row, i).Value = find_val Then
linelookup = Sheets(1).Cells(cur_row, (i + 1)).Value
i = endcol
End If
Next i
--------------------


--
johan@durban
------------------------------------------------------------------------
johan@durban's Profile: http://www.excelforum.com/member.php...o&userid=34266
View this thread: http://www.excelforum.com/showthread...hreadid=540570

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default Reading the row number with VBA

Hi
Activecell.row will do it.

regards
Paul

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Reading the row number with VBA


Thank you everyone.
The caller property did it for me. I am also going to explore other
ways (just for fun).


--
johan@durban
------------------------------------------------------------------------
johan@durban's Profile: http://www.excelforum.com/member.php...o&userid=34266
View this thread: http://www.excelforum.com/showthread...hreadid=540570

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
Easy Reading - large number minus small number MUTTMIND New Users to Excel 5 February 5th 09 10:08 AM
reading from SQL Texas Tonie[_2_] Excel Discussion (Misc queries) 0 November 9th 07 10:59 PM
52 Bad file name or number - when reading file from FTP Olle Excel Programming 1 June 3rd 05 08:26 AM
reading currency/number whitesnow Excel Discussion (Misc queries) 1 December 15th 04 09:43 AM
reading xls from asp mrweb Excel Programming 0 October 20th 03 08:54 PM


All times are GMT +1. The time now is 12:14 AM.

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

About Us

"It's about Microsoft Excel"