View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Grant Reid Grant Reid is offline
external usenet poster
 
Posts: 51
Default Passing Arguments

Hi

I need to apply a similar methodology to determine the last column in a
given worksheet. Once again, assume that I have button on Sheet1.

I want to attach the LastColumn macro to this button. What I'm attempting to
establish is to find the last column in a range but on a different sheet, so
I'll need to pass both the starting cell address and the sheet name eg;

Sub LastColumn
Dim strLastCol As String
strLastCol = FindLastCol("B10", "Sheet 1")
ActiveCell.Formula = strLastCol
End Sub

Its the called function FindLastCol, that I'm battling with. Can anyone help
fill in the blanks?

Public Function FindLastCol(??????????, mySh As String) As String
FindLastCol = Worksheets(mySh).??????????????
End Function

Many Thanks - Grant