I'm going mad!
I'm exporting a query to excel, and afterwards calculating a field, and a
sum of all fields in Excel from a sub procedure in a Module in Access.
First I used
xlSheet.Range("L" & nNoRows + 2).Select
'ActiveCell.FormulaR1C1 = "=SUM(R2C:R[-1]C)"
which works fine the first time I run the sub procedure - but the second
time it doesn't work :-((
It says Activecell Object variable or with block not set !
Well I changed it to:
xlSheet.Cells(nNoRows + 2, 12).Value = "=SUM(R2C:R[-1]C)" which work every
time - but now I have another problem, which I think is the same as the one
mentioned above.
I want to put one line over the sum, and two line under - and I use the
following code:
xlSheet.Range("C" & nNoRows + 2 & ":L" & nNoRows + 2).Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Again it works the first time I run the sub procedure - but only once
Help is appreciated after many attemps :-(
TIA jj |