I need some code tweaking.
I have 2 Excel Workbooks.
Workbook 1 needs a function to find a matching string in column A and return cell contents from column B of Workbook2.Worksheet??. The worksheet will need to be passed as a parameter in the function.
I have an idea of the structure of the coding, however, I don't code in Excel VBA so feel free to correct or start over.
Public Function GLAmt(Acct As String, FileName As String, TB As String) As Double
Dim wBook As Workbook
Dim wSheet As Worksheet
'Set variable for storing amount retrieved from acct # Column
Dim AMT As Double
'Dim variable for storing row number of found cell (if needed)
Dim x As Integer
Set wBook = FileName
Set wSheet = wBook.Worksheets(TB)
'Go To TB Worksheet
'Look for Acct # in Column ___
'Get Amount from Column ___
'x = row that acct # was found
AMT = wSheet.Cells(x, B).Value
'Set Function variable equal to amt variable.
GLAmt = AMT