Created
July 10, 2015 14:33
-
-
Save DouglasdeMoura/d870c33cc22149d94f4e to your computer and use it in GitHub Desktop.
Functions to save data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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