Help...........

L

learning_codes

Hi,

I’m able to generate the total but I’m not able to create border from
A1 up to Grand Total (Last row of the data) instead of A28 (see part
B).

Is there possible to make the line if you can help me out.

I’m looking for this one: Set xlRange = Range(Cells(1, 1),
Cells(Grand Total, 10))
instead of Set xlRange = Range(Cells(1, 1), Cells(28, 10))

Your help would be much appreciated.
Thanks...
_____________________________________________________________________________

‘Part A -
##################################################################

Set ExcelWorksheet = ExcelWorksheet.Cells(5, 1)
On Error Resume Next
ExcelWorksheet.RemoveSubtotal
x = 1
'Not need For Each fld In rs4.Fields
'Not need ExcelWorksheet.Cells(6, x).Value = fld.Name
'Not need x = x + 1
'Not need Next
Set ExcelWorksheet = ExcelWorksheet.Cells(1, 1)
'Not need ExcelWorksheet.CopyFromRecordset rs4
'ExcelWorksheet.Columns.AutoFit

With ExcelWorksheet
.Range("A9").EntireColumn.ColumnWidth = "19"
.Range("b9").Resize(1, 13).EntireColumn.AutoFit
End With

Set ExcelWorksheet = ExcelWorksheet.Columns("B:A")
ExcelWorksheet.NumberFormat = "0"
Set ExcelWorksheet =
ExcelWorksheet.Range(ExcelWorksheet.Cells(1, 1), _
ExcelWorksheet.Cells(rs4.RecordCount + 1,
rs4.Fields.Count))
ExcelWorksheet.Subtotal 1, xlCount, 2, True, False,
xlSummaryBelow
ExcelWorksheet.Outline.ShowLevels 2


‘Part B -
#####################################################################

OutLineWeight = "none"
InLineWeight = "none"
Set xlRange = Range(Cells(1, 1), Cells(28, 10))
Call xlBorders(xlRange, OutLineWeight, InLineWeight)
 
D

Dave Peterson

I'd try something like:

Set xlRange = ExcelWorksheet.Range("A1:J" & rs4.RecordCount + 1)

(not sure if you want the +1 or not...)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top