S
Stefan Mueller
The following vbs code opens Excel and selects the ranges A1-A10 and C2-C8:
Set objExcel = CreateObject("Excel.Application")
objExcel.Workbooks.Add
objExcel.Visible = True
objExcel.ActiveSheet.Range("A1:A10,C2:C8").Select
But how can I do such a selection with variables?
e.g.
SelectionPart1_Column = 1
SelectionPart1_RowFrom = 1
SelectionPart1_RowTo = 10
SelectionPart2_Column = 3
SelectionPart2_RowFrom = 2
SelectionPart2_RowTo = 8
The following command selects only the first part (A1-A10):
objExcel.ActiveSheet.Range(objExcel.Cells(SelectionPart1_RowFrom,
SelectionPart1_Column), objExcel.Cells(SelectionPart1_RowTo,
SelectionPart1_Column)).Select
But how can I add to the already selected part 1 also part 2 (C2-C8)?
Any help is very appreciated
Stefan
Set objExcel = CreateObject("Excel.Application")
objExcel.Workbooks.Add
objExcel.Visible = True
objExcel.ActiveSheet.Range("A1:A10,C2:C8").Select
But how can I do such a selection with variables?
e.g.
SelectionPart1_Column = 1
SelectionPart1_RowFrom = 1
SelectionPart1_RowTo = 10
SelectionPart2_Column = 3
SelectionPart2_RowFrom = 2
SelectionPart2_RowTo = 8
The following command selects only the first part (A1-A10):
objExcel.ActiveSheet.Range(objExcel.Cells(SelectionPart1_RowFrom,
SelectionPart1_Column), objExcel.Cells(SelectionPart1_RowTo,
SelectionPart1_Column)).Select
But how can I add to the already selected part 1 also part 2 (C2-C8)?
Any help is very appreciated
Stefan