Using remote Automation from MS Access, the ObjXL is just an object reference.
A recordset (using copy from recordset) inserts data at cell A6. The Recordcount is known.
The recordcount variable is used to set the range to match the number of records returned.
There are 15 columns midway - if an entire column is Empty - then it should be hidden.
This code worked great for a hard-coded range!!
Tried to apply it using the offset and with the ActiveCell. Stepping through debugger, it perfectly highlights the perfect range in each step. PROBLEM - it always returns 1 no matter if empty or populated for each range in the loop.
A recordset (using copy from recordset) inserts data at cell A6. The Recordcount is known.
The recordcount variable is used to set the range to match the number of records returned.
There are 15 columns midway - if an entire column is Empty - then it should be hidden.
This code worked great for a hard-coded range!!
Code:
? objxl.Application.WorksheetFunction.CountA(objxl.Range("L6:L20"))
Tried to apply it using the offset and with the ActiveCell. Stepping through debugger, it perfectly highlights the perfect range in each step. PROBLEM - it always returns 1 no matter if empty or populated for each range in the loop.
Code:
ObjXL.Range("A6").Select
ObjXL.ActiveCell.Offset(0, 8).Range("A1").Select
For ColumnCounter = 1 To 15
ObjXL.ActiveCell.Offset(0, 1).Range("A1").Select
If ObjXL.Application.WorksheetFunction.CountA(ObjXL.ActiveCell.Range("A1:A" & rsRowCount).Select) = 0 Then
' function "Hide this column!" ' Checks Start row, column - range is dependent on Recordset
Debug.Print ObjXL.Application.WorksheetFunction.CountA(ObjXL.ActiveCell.Range("A1:A" & rsRowCount).Select)
Else
' do nothing
End If
Next