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
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"
or
CellAddress, NewValue, Optional WB = "This", Optional Shee = "Active"
Views 787
Downloads 312
CodeID
DB ID
ANmarAmdeen
609
Revisions
v1.0
Saturday
October
31
2020