From 90caea49f65cb73122e06f99287a782687513f5d Mon Sep 17 00:00:00 2001 From: Trowbridge Date: Wed, 20 Mar 2019 17:03:55 -0400 Subject: [PATCH] use current region functionality to get range --- TheBigOne.cls | 93 +++++++++++++++++++++++++-------------------------- 1 file changed, 46 insertions(+), 47 deletions(-) diff --git a/TheBigOne.cls b/TheBigOne.cls index d4a45f0..fd5ef9a 100644 --- a/TheBigOne.cls +++ b/TheBigOne.cls @@ -1463,7 +1463,7 @@ Public Function MISCp_msgbox_cancel(ByRef Message As String, Optional ByRef TITL MsgB.Caption = TITLE MsgB.tbMSG.ScrollBars = fmScrollBarsBoth MsgB.Show - MISC_msgbox_cancel = MsgB.cancel + MISC_msgbox_cancel = MsgB.Cancel Application.EnableCancelKey = xlInterrupt End Function @@ -2034,7 +2034,7 @@ Function json_concat(list As Range) As String 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 @@ -2042,7 +2042,7 @@ Public Function ADOp_BuildInsertSQL(ByRef tbl() As String, Target As String, tri Dim sql As String Dim rec As String - sql = "INSERT INTO " & Target & " VALUES " & vbCrLf + sql = "INSERT INTO " & target & " VALUES " & vbCrLf For i = start To ending rec = "" 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 - width As Long + Dim width As Long width = UBound(dump, 2) Dim newcol As String newcol = ConvertBase10(upperleft.column + UBound(dump, 2), "ABCDEFGHIJKLMNOPQRSTUVWXYZ") @@ -2438,51 +2438,50 @@ End Function Public Function SHTp_get_block(point As Range) As Variant() - Dim left As Long - Dim right As Long - Dim top As Long - Dim bot As Long - Dim i As Long - Dim lcol As String - Dim rcol As String - Dim r As Range - - - i = 0 - Do Until point.Worksheet.Cells(point.row, point.column + i) = "" - i = i + 1 - Loop - If i <> 0 Then i = i - 1 - right = point.column + i - - i = 0 - Do Until point.Worksheet.Cells(point.row, point.column + i) = "" - i = i - 1 - Loop - If i <> 0 Then i = i + 1 - left = point.column + i - - i = 0 - Do Until point.Worksheet.Cells(point.row + i, point.column) = "" - i = i + 1 - Loop - If i <> 0 Then i = i - 1 - bot = point.row + i - - i = 0 - Do Until point.Worksheet.Cells(point.row + i, point.column) = "" - i = i - 1 - If point.row + i < 1 Then Exit Do - Loop - If i <> 0 Then i = i + 1 - top = point.row + i - - lcol = Me.ColumnLetter(left) - rcol = Me.ColumnLetter(right) +' Dim left As Long +' Dim right As Long +' Dim top As Long +' Dim bot As Long +' Dim i As Long +' Dim lcol As String +' Dim rcol As String +' Dim r As Range +' +' +' i = 0 +' Do Until point.Worksheet.Cells(point.row, point.column + i) = "" +' i = i + 1 +' Loop +' If i <> 0 Then i = i - 1 +' right = point.column + i +' +' i = 0 +' Do Until point.Worksheet.Cells(point.row, point.column + i) = "" +' i = i - 1 +' Loop +' If i <> 0 Then i = i + 1 +' left = point.column + i +' +' i = 0 +' Do Until point.Worksheet.Cells(point.row + i, point.column) = "" +' i = i + 1 +' Loop +' If i <> 0 Then i = i - 1 +' bot = point.row + i +' +' i = 0 +' Do Until point.Worksheet.Cells(point.row + i, point.column) = "" +' i = i - 1 +' If point.row + i < 1 Then Exit Do +' Loop +' If i <> 0 Then i = i + 1 +' top = point.row + i +' +' lcol = Me.ColumnLetter(left) +' rcol = Me.ColumnLetter(right) 'point.row (right) - Set r = Worksheets("_month").Range(lcol & top & ":" & rcol & bot) - SHTp_get_block = r + SHTp_get_block = point.CurrentRegion End Function