I'm using an Excel application object in Access to make modifications to a file prior to importing it. What I want to do is select the column after the final column (the number of columns if variable) but not the entire column. I don't want the first cell and I don't want any cells below the Current Region.
I'm new to Excel VBA but I've figured out one way of doing it:
I'd like something a little more "elegant" though, and more precise. If for some reason the current region contained blank columns or rows, I think I'd have a problem since I'm putting a formula into the range that references the cell to the left.
Any suggestions?
-Coco
![[auto] [auto] [auto]](/data/assets/smilies/auto.gif)
I'm new to Excel VBA but I've figured out one way of doing it:
Code:
'find column after the last column
myexcel.Selection.SpecialCells(xlCellTypeLastCell).Select
myexcel.ActiveCell.Offset(-1, 1).Range("A1").Select
'determine the range boundaries
cell_1 = myexcel.ActiveCell.Address
cell_2 = myexcel.ActiveCell.Offset(0 - myexcel.ActiveCell.Row + 2, _
0).Range("A1").Address
'select the range
myexcel.Range(cell_1, cell_2).Select
Any suggestions?
-Coco
![[auto] [auto] [auto]](/data/assets/smilies/auto.gif)