i found this absent function that searces through all the sheets of a workbook and finds a match and returns the value from column 5
however ive been trying to modify the
absent = Sheets(sht).Cells(c.Row, 5) line to return both column 5 and 6 but to put the column 6 value in the column next to the column where the =Absent(A1) formula is in the spreadsheet
ive tried
absent = Sheets(sht).Cells(c.Row, 5, ActiveCell.Offset(0, 1).Cells(c.Row, 6
absent = Sheets(sht).Cells(c.Row, 5, ActiveCell.Offset(0, 1), 6)
absent = Sheets(sht).Cells(c.Row, 5, 6)
nothing is working it works great returning the value from column 5 but how can i get the value from column 6 also to be added into the adjacent cell, please help!!! :'(
Option Explicit
Function absent(ByVal find_name As Range)
Dim sht As Integer, c As Variant
Application.Volatile
'Loop through sheets
For sht = 2 To Sheets.Count
'"Lookup" Value from argument cell in each sheet
With Sheets(sht).Columns(2).Cells
Set c = .Find(find_name)
If Not c Is Nothing Then
absent = Sheets(sht).Cells(c.Row, 5)
End If
End With
Next
End Function
however ive been trying to modify the
absent = Sheets(sht).Cells(c.Row, 5) line to return both column 5 and 6 but to put the column 6 value in the column next to the column where the =Absent(A1) formula is in the spreadsheet
ive tried
absent = Sheets(sht).Cells(c.Row, 5, ActiveCell.Offset(0, 1).Cells(c.Row, 6
absent = Sheets(sht).Cells(c.Row, 5, ActiveCell.Offset(0, 1), 6)
absent = Sheets(sht).Cells(c.Row, 5, 6)
nothing is working it works great returning the value from column 5 but how can i get the value from column 6 also to be added into the adjacent cell, please help!!! :'(
Option Explicit
Function absent(ByVal find_name As Range)
Dim sht As Integer, c As Variant
Application.Volatile
'Loop through sheets
For sht = 2 To Sheets.Count
'"Lookup" Value from argument cell in each sheet
With Sheets(sht).Columns(2).Cells
Set c = .Find(find_name)
If Not c Is Nothing Then
absent = Sheets(sht).Cells(c.Row, 5)
End If
End With
Next
End Function
Last edited: