View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
snoopy369[_3_] snoopy369[_3_] is offline
external usenet poster
 
Posts: 1
Default How do I pass a worksheets name to function?

If I understand your question right, you want to rewrite the functio
this way: (changes in bold)

sub test()

recct = wsreccount("sheet1")

msgbox recct



function wsreccount (wsname as *String*)

wsreccount = *Worksheets(wsname)*.UsedRange.Rows.Count

end function

---
using the Worksheets(String) property to choose a worksheet based on
name as string. You could also use

Activesheet.name

to get the current sheet's name, if you'd rather have this be variabl
per sheet

--
Message posted from http://www.ExcelForum.com