Skip to content

Instantly share code, notes, and snippets.

@DouglasdeMoura
Created July 10, 2015 14:33
Show Gist options
  • Save DouglasdeMoura/d870c33cc22149d94f4e to your computer and use it in GitHub Desktop.
Save DouglasdeMoura/d870c33cc22149d94f4e to your computer and use it in GitHub Desktop.
Functions to save data
Public Function RowNumber(Col As String, Optional RowOffset As Variant = 1, Optional ColumnOffset As Variant = 0) As Long
RowNumber = Cells(Rows.Count, Col).End(xlUp).Offset(RowOffset, ColumnOffset).Row
End Function
Public Function SaveData(Columns As Variant, Data As Variant, RowNumber As Long)
Dim i As Long
i = 1
For Each Column In Columns
Range(Column & RowNumber) = Data(i)
i = i + 1
Next Column
End Function
Sub SavingData()
Dim arr(1 To 3) As Variant
Dim arr2(1 To 3) As Variant
arr(1) = "A"
arr(2) = "B"
arr(3) = "C"
arr2(1) = "Test 1"
arr2(2) = "Test 2"
arr2(3) = "Test 3"
Call SaveData(arr, arr2, RowNumber("A"))
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment