ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   how to use the function written in VBA in excel sheet (https://www.excelbanter.com/excel-discussion-misc-queries/164026-how-use-function-written-vba-excel-sheet.html)

kelly

how to use the function written in VBA in excel sheet
 
Hi, dear all

i wrote a small function in VBA and want to use it in excel sheet. the
script is like,


Function sample(sheetname As Integer) As Integer

Dim R As Excel.Range
Dim c As Variant

sample = 0
For Each c In Worksheets(sheetname).Range("A1").CurrentRegion
If Right(c.Value, 1) = "*" Then
sample = 1
Exit Function
End If
Next

End Function

But when i type the formular in excel sheet, it can not work.
My problem is how can i use this function in excel sheet???

Thank you



All times are GMT +1. The time now is 09:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com