XLA routines: EE_Table
If you use Excel as a database, EE_Table will return the range object of your data. You can then manipulate this.
uses EE_GetLastPopulatedCell to find the last cell of the table
Function EE_Table(strHeaderString As String, wks As Worksheet) As range '> - takes a heading string, and a worksheet name '> - returns a range object that represents the table around the data '> - code will look for the heading on the target sheet, then assume this is '> row1. '> - it will then work out the start row, end row, start col and end col and '> return the range. Dim rng As range Dim rngTemp As range 'http://excelexperts.com/xla-routines-eetable On Error Resume Next Set rng = wks.Cells.Find(what:=strHeaderString, LookIn:=xlValues, lookat:=xlWhole).CurrentRegion On Error GoTo 0 If Not rng Is Nothing Then Set rngTemp = rng.CurrentRegion Set EE_Table = range(wks.Cells(rng.Row, rngTemp.Column), EE_GetLastPopulatedCell(wks)) End If Set rngTemp = Nothing Set rng = Nothing End Function
»
- Nick's blog
- Login or register to post comments
- 3077 reads
Recent comments
5 years 41 weeks ago
6 years 27 weeks ago
6 years 39 weeks ago
6 years 42 weeks ago
6 years 43 weeks ago
6 years 48 weeks ago
7 years 4 weeks ago
7 years 5 weeks ago
7 years 5 weeks ago
7 years 5 weeks ago