Add2Column

Quickly adds value to certain column in Excel sheet
As usual, you can define the sheet, the workbook as well as the column to be added
You can also assign a Header row, where the function will assume that row has the header for that list, and adds below it.
Returns the row where that new value has been added

CodeFunctionName
What is this?

Public

Tested

Original Work
Function Add2Column(Add2Col, AddValue, Optional HeadRow = 1, Optional Wb = "This", Optional Shee = "This")
' Adds value to a column, and returns the row where added
' HeadRow is the row number where the head row is found, which will make function to add new values below it
' Does not check for uniqueness
'
If Wb = "This" Then Wb = ThisWorkbook.Name
If Shee = "This" Then Shee = Workbooks(Wb).Worksheets(1).Name
NewOffset = WorksheetFunction.CountA(Workbooks(Wb).Worksheets(Shee).Range(Add2Col & 1).EntireColumn)
Workbooks(Wb).Worksheets(Shee).Range(Add2Col & HeadRow).Offset(NewOffset, 0).Value = AddValue
Add2Column = Range(Add2Col & HeadRow).Offset(NewOffset, 0).Row
End Function

Add2Col, AddValue, Optional HeadRow = 1, Optional Wb = "This", Optional Shee = "This"

Add2Column "C", Date, 6
Add2Column "D", "Reached today", 6

Views 1,288

Downloads 455

CodeID
DB ID