Skip to content

Instantly share code, notes, and snippets.

Created August 29, 2017 03:56
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Public Function DataGet(SheetName As String, StartRow As Integer, StartColumn As Integer) As Variant
Dim EndRow As Integer
Dim EndColumn As Integer
Dim Data As Variant
With Sheets(SheetName)
EndColumn = .Cells(StartRow, StartColumn).End(xlToRight).Column
EndRow = .Cells(StartRow, StartColumn).End(xlDown).row
End With
Data = Sheets(SheetName).Range(Sheets(SheetName).Cells(StartRow, StartColumn), Sheets(SheetName).Cells(EndRow, EndColumn))
Dim i As Integer '空白の個所だけを狙ってループを回す
For i = 1 To UBound(Data, 1)
Data(i, 2) = Sheets(SheetName).Cells(StartRow + i - 1, StartColumn + 1).Interior.Color
Next i
DataGet = Data
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment