View Single Post
 
Old 10-18-2019, 06:55 PM
koehlerc14 koehlerc14 is offline Windows 10 Office 2016
Novice
 
Join Date: Feb 2019
Posts: 6
koehlerc14 is on a distinguished road
Default

Thanks to tips and other threads to lead me to a solution, I'm not entirely sure why it works, but I'm still testing some things out. I'm able to reference it in the Sub. If anyone has any tips to declare parameter from a function to a sub I'd still appreciate it.

Function Row & Column
Code:
Public Function Lastrow() As Long
'Function finding the last row in active worksheet with data
    Dim nrow As Long
    nrow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
    
Lastrow = nrow
nrow = Lastrow

End Function

Public Function Farcol() As String
'Function finding the Far Column in active worksheet with data
    ncol = ActiveSheet.UsedRange.Columns.Count
    lcol = Split(Cells(1, ncol).Address(True, False), "$")
    lcol = lcol(0)

Farcol = lcol
Sub Macro
Code:
End Function

Sub Display_LastCell()
'Display the last cell with data using Function

Call Lastrow
Call Farcol

MsgBox "Row = " & nrow & " Column = " & Farcol

End Sub
Next is to use as Cell Reference to the range...
Reply With Quote