use current region functionality to get range

This commit is contained in:
Trowbridge 2019-03-20 17:03:55 -04:00
parent c5f28a081b
commit 90caea49f6

View File

@ -1463,7 +1463,7 @@ Public Function MISCp_msgbox_cancel(ByRef Message As String, Optional ByRef TITL
MsgB.Caption = TITLE MsgB.Caption = TITLE
MsgB.tbMSG.ScrollBars = fmScrollBarsBoth MsgB.tbMSG.ScrollBars = fmScrollBarsBoth
MsgB.Show MsgB.Show
MISC_msgbox_cancel = MsgB.cancel MISC_msgbox_cancel = MsgB.Cancel
Application.EnableCancelKey = xlInterrupt Application.EnableCancelKey = xlInterrupt
End Function End Function
@ -2034,7 +2034,7 @@ Function json_concat(list As Range) As String
End Function End Function
Public Function ADOp_BuildInsertSQL(ByRef tbl() As String, Target As String, trim As Boolean, start As Long, ending As Long, ParamArray ftype()) As String Public Function ADOp_BuildInsertSQL(ByRef tbl() As String, target As String, trim As Boolean, start As Long, ending As Long, ParamArray ftype()) As String
Dim i As Long Dim i As Long
@ -2042,7 +2042,7 @@ Public Function ADOp_BuildInsertSQL(ByRef tbl() As String, Target As String, tri
Dim sql As String Dim sql As String
Dim rec As String Dim rec As String
sql = "INSERT INTO " & Target & " VALUES " & vbCrLf sql = "INSERT INTO " & target & " VALUES " & vbCrLf
For i = start To ending For i = start To ending
rec = "" rec = ""
If i <> start Then sql = sql & "," & vbCrLf If i <> start Then sql = sql & "," & vbCrLf
@ -2404,7 +2404,7 @@ End Function
Public Function TBLp_range(ByRef dump() As Variant, ByVal upperleft As Range) As Range Public Function TBLp_range(ByRef dump() As Variant, ByVal upperleft As Range) As Range
width As Long Dim width As Long
width = UBound(dump, 2) width = UBound(dump, 2)
Dim newcol As String Dim newcol As String
newcol = ConvertBase10(upperleft.column + UBound(dump, 2), "ABCDEFGHIJKLMNOPQRSTUVWXYZ") newcol = ConvertBase10(upperleft.column + UBound(dump, 2), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")
@ -2438,51 +2438,50 @@ End Function
Public Function SHTp_get_block(point As Range) As Variant() Public Function SHTp_get_block(point As Range) As Variant()
Dim left As Long ' Dim left As Long
Dim right As Long ' Dim right As Long
Dim top As Long ' Dim top As Long
Dim bot As Long ' Dim bot As Long
Dim i As Long ' Dim i As Long
Dim lcol As String ' Dim lcol As String
Dim rcol As String ' Dim rcol As String
Dim r As Range ' Dim r As Range
'
'
i = 0 ' i = 0
Do Until point.Worksheet.Cells(point.row, point.column + i) = "" ' Do Until point.Worksheet.Cells(point.row, point.column + i) = ""
i = i + 1 ' i = i + 1
Loop ' Loop
If i <> 0 Then i = i - 1 ' If i <> 0 Then i = i - 1
right = point.column + i ' right = point.column + i
'
i = 0 ' i = 0
Do Until point.Worksheet.Cells(point.row, point.column + i) = "" ' Do Until point.Worksheet.Cells(point.row, point.column + i) = ""
i = i - 1 ' i = i - 1
Loop ' Loop
If i <> 0 Then i = i + 1 ' If i <> 0 Then i = i + 1
left = point.column + i ' left = point.column + i
'
i = 0 ' i = 0
Do Until point.Worksheet.Cells(point.row + i, point.column) = "" ' Do Until point.Worksheet.Cells(point.row + i, point.column) = ""
i = i + 1 ' i = i + 1
Loop ' Loop
If i <> 0 Then i = i - 1 ' If i <> 0 Then i = i - 1
bot = point.row + i ' bot = point.row + i
'
i = 0 ' i = 0
Do Until point.Worksheet.Cells(point.row + i, point.column) = "" ' Do Until point.Worksheet.Cells(point.row + i, point.column) = ""
i = i - 1 ' i = i - 1
If point.row + i < 1 Then Exit Do ' If point.row + i < 1 Then Exit Do
Loop ' Loop
If i <> 0 Then i = i + 1 ' If i <> 0 Then i = i + 1
top = point.row + i ' top = point.row + i
'
lcol = Me.ColumnLetter(left) ' lcol = Me.ColumnLetter(left)
rcol = Me.ColumnLetter(right) ' rcol = Me.ColumnLetter(right)
'point.row (right) 'point.row (right)
Set r = Worksheets("_month").Range(lcol & top & ":" & rcol & bot) SHTp_get_block = point.CurrentRegion
SHTp_get_block = r
End Function End Function