CellSave and CellRead

Reads a cell or Saves value into certain cell, in certain sheet and workbook.
Can ignore passing workbook and/or sheet to use ThisWorkbook and ActiveSheet respectively.
Stupidly simple, but effective and used a lot in my own code.
Maybe next version can have ability to save more than 1 cell at a time.

Similar to SettingRead and SettingSave

CodeFunctionName
What is this?

Public

Tested

Original Work

Function CellRead(CellAddress, Optional WB = "This", Optional Shee = "Active")
    If WB = "This" Then WB = ThisWorkbook.Name
    If WB = "Active" Then WB = ActiveWorkbook.Name
    If Shee = "Active" Then Shee = Workbooks(WB).ActiveSheet.Name
    CellRead = Workbooks(WB).Worksheets(Shee).Range(CellAddress).Value
End Function

Sub CellSave(CellAddress, NewValue, Optional WB = "This", Optional Shee = "Active")
    If WB = "This" Then WB = ThisWorkbook.Name
    If WB = "Active" Then WB = ActiveWorkbook.Name
    If Shee = "Active" Then Shee = Workbooks(WB).ActiveSheet.Name
    Workbooks(WB).Worksheets(Shee).Range(CellAddress).Value = NewValue
End Sub

CellAddress, Optional WB = "This", Optional Shee = "Active"
or
CellAddress, NewValue, Optional WB = "This", Optional Shee = "Active"

Views 785

Downloads 311

CodeID
DB ID