![]() |
Specifying position of new Worksheets via C or VBA
How can I control the positon of a newly added worksheet added via C?
When I use the published code ThisWorkbook.Worksheets.Add( Type.Missing, Type.Missing, Type.Missing, Type.Missing) it inserts the new Worksheet after the Active Worksheet. I want to control exactly where it is inserted, probably I can tell by the parameters but don't have any explanation. I tried several things but getting error messages only. Thanks - Reinhard |
Specifying position of new Worksheets via C or VBA
The Object Browser in Excel's VB Editor has this to say:
Function Add([Before], [After], [Count], [Type]) As Object Member of Excel.Worksheets There are more details in MSDN: expression.Add(Before, After, Count, Type) expression: Required. An expression that returns one of the above objects (Sheet or Worksheet). Befo Optional Variant. An object that specifies the sheet before which the new sheet is added. After: Optional Variant. An object that specifies the sheet after which the new sheet is added. Count: Optional Variant. The number of sheets to be added. The default value is one. Type: Optional Variant. Specifies the sheet type. Can be one of the following XlSheetType constants: xlWorksheet, xlChart, xlExcel4MacroSheet, or xlExcel4IntlMacroSheet. The default value is xlWorksheet. - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ _______ Reinhard F. Bentrup wrote: How can I control the positon of a newly added worksheet added via C? When I use the published code ThisWorkbook.Worksheets.Add( Type.Missing, Type.Missing, Type.Missing, Type.Missing) it inserts the new Worksheet after the Active Worksheet. I want to control exactly where it is inserted, probably I can tell by the parameters but don't have any explanation. I tried several things but getting error messages only. Thanks - Reinhard |
All times are GMT +1. The time now is 01:04 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com