CellRead

Reads a value giving column, row, sheet and workbook name
Accepts up to 2 column entries (formatted as "D+R" in ColumnName) to concatenate value from col D then from col R, adding space between them

CodeFunctionName
What is this?

Public

Tested

Original Work
Function CellRead(ColumnName, RowNumber, Wb = "This", Optional SrcSheet = "Active")
    ' Reads a value giving column, row, sheet and workbook name
    '    Accepts up to 2 column entries (formatted as "D+R" in ColumnName) to concatenate value from col D then from col R, adding space between them
    ' Needs CutString3
    Col1 = ColumnName
    Col2 = ""
    If Wb = "This" Then Wb = ThisWorkbook.Name
    If SrcSheet = "Active" Then SrcSheet = Workbooks(Wb).ActiveSheet.Name
    If InStr(1, ColumnName, "+") > 0 Then
        Col1 = CutString3(ColumnName, 1, "+")
        Col2 = CutString3(ColumnName, 2, "+")
    End If
    Val1 = Workbooks(Wb).Worksheets(SrcSheet).Range(Col1 & RowNumber).Value
    If Col2 > "" Then _
        Val1 = Val1 & " " & Workbooks(Wb).Worksheets(SrcSheet).Range(Col2 & RowNumber).Value
    CellRead = Val1
End Function

ColumnName, RowNumber, Wb = "This", Optional SrcSheet = "Active"

Views 3,013

Downloads 1,169

CodeID
DB ID

ANmarAmdeen
608
Attachments
Revisions

v1.0

Wednesday
February
28
2024