worksheet

Trying to add multiple sheets to excel

不问归期 提交于 2019-11-28 08:28:50
问题 i'm trying to programmatically add sheets to a new excel document. my expected output is sheets named 'test1-20' but instead i get 'Sheet1-19, test20'. why doesn't this work? Workbook workbook; Application objExcel; objExcel = new Application(); objExcel.Visible = false; objExcel.DisplayAlerts = false; for (var i = 0; i < worksheets.Count; i++) { workbook= objExcel.Workbooks.Add(Missing.Value); var worksheet = (Worksheet)workbook.Worksheets.get_Item(i + 1); worksheet.Name = string.Format(

How can I use VBA to list all worksheets in a workbook within a string?

空扰寡人 提交于 2019-11-28 08:15:05
问题 How can I use VBA to get the names of all the worksheets (or alternatively a maximum of three) within the active workbook to be returned as a string? For context, I will then use the string in naming the workbook when it is saved. I have figured out how to create a savename for the file using input dialogs and so on, so it's only a case of getting VBA to return something like "[Worksheet 1 name] and [Worksheet 2 name]". Thanks so much! 回答1: Option Explicit Sub namesheets() Dim wks as

Find the last used row in Excel with C# [duplicate]

好久不见. 提交于 2019-11-28 03:42:52
问题 This question already has answers here : Closed 6 years ago . Possible Duplicate: How to get the range of occupied cells in excel sheet Im trying to find the last used row in an Excel worksheet. For doing this, I'm using this code: int lastUsedRow = currentWS.Cells.SpecialCells(Excel.XlCellType.xlCellTypeLastCell,Type.Missing).Row; Most of the time it works fine, but sometimes Excel thinks that there's more rows in the sheet than theres suppose to be. Fx: If I copy data from sheet1,

Excel VBA For Each Worksheet Loop

点点圈 提交于 2019-11-27 21:19:23
I am working on code to basically go through each sheet in my Workbook, and then update column widths. Below is the code I wrote; I don't receive any errors, but it also doesn't actually do anything. Any help is greatly appreciated! Option Explicit Dim ws As Worksheet, a As Range Sub forEachWs() For Each ws In ActiveWorkbook.Worksheets Call resizingColumns Next End Sub Sub resizingColumns() Range("A:A").ColumnWidth = 20.14 Range("B:B").ColumnWidth = 9.71 Range("C:C").ColumnWidth = 35.86 Range("D:D").ColumnWidth = 30.57 Range("E:E").ColumnWidth = 23.57 Range("F:F").ColumnWidth = 21.43 Range("G

How to setup Intellij 14 Scala Worksheet to run Spark

淺唱寂寞╮ 提交于 2019-11-27 17:15:01
问题 I'm trying to create a SparkContext in an Intellij 14 Scala Worksheet. here are my dependencies name := "LearnSpark" version := "1.0" scalaVersion := "2.11.7" // for working with Spark API libraryDependencies += "org.apache.spark" %% "spark-core" % "1.4.0" Here is the code i run in the worksheet import org.apache.spark.{SparkContext, SparkConf} val conf = new SparkConf().setMaster("local").setAppName("spark-play") val sc = new SparkContext(conf) error 15/08/24 14:01:59 ERROR SparkContext:

Query my excel worksheet with VBA

孤者浪人 提交于 2019-11-27 15:42:20
Is it possible to query a worksheet using VBA? I want to be able to select all the values in the time column i.e. (00:00) WHERE the day equals for example: Saturday I there any way to do this, a tutorial would be really helpful. Thanks You can programmtically create an AutoFilter, then select the matching values: Dim ws As Worksheet: Set ws = ActiveSheet With ws .AutoFilterMode = False .Range("1:1").AutoFilter .Range("1:1").AutoFilter field:=2, Criteria1:="=Saturday", Operator:=xlAnd With .AutoFilter.Range On Error Resume Next ' if none selected .Offset(1).Resize(.Rows.Count - 1).Columns(2)

How to get inline results in a worksheet in Eclipse/Scala-IDE on Ubuntu 12.04?

梦想的初衷 提交于 2019-11-27 07:48:57
问题 I've got the Scala-IDE installed on my Mac and on my pc with Ubuntu 12.04. In there I created a project, with a package and in there a worksheet. On my mac, the worksheet shows results of every line on the same line on the right. For example: package mypackage object myworksheet { println("Hello World!") > Hello World! } On Ubuntu however, I do not see the result on the right. I've tried making changes in the worksheet and saving it, but it makes no difference. Does anybody know how I can get

xlsxwriter: is there a way to open an existing worksheet in my workbook?

谁都会走 提交于 2019-11-27 07:39:10
I'm able to open my pre-existing workbook, but I don't see any way to open pre-existing worksheets within that workbook. Is there any way to do this? You cannot append to an existing xlsx file with xlsxwriter . There is a module called openpyxl which allows you to read and write to preexisting excel file, but I am sure that the method to do so involves reading from the excel file, storing all the information somehow (database or arrays), and then rewriting when you call workbook.close() which will then write all of the information to your xlsx file. Similarly, you can use a method of your own

C# - How to add an Excel Worksheet programmatically - Office XP / 2003

馋奶兔 提交于 2019-11-27 07:17:21
I am just starting to fiddle with Excel via C# to be able to automate the creation, and addition to an Excel file. I can open the file and update its data and move through the existing worksheets. My problem is how can I add new sheets? I tried: Excel.Worksheet newWorksheet; newWorksheet = (Excel.Worksheet)excelApp.ThisWorkbook.Worksheets.Add( Type.Missing, Type.Missing, Type.Missing, Type.Missing); But I get below COM Exception and my googling has not given me any answer. Exception from HRESULT: 0x800A03EC Source is: "Interop.Excel" I am hoping someone maybe able to put me out of my misery.

Excel tab sheet names vs. Visual Basic sheet names

人走茶凉 提交于 2019-11-26 23:10:24
It seems that Visual Basic can not reference sheets according to user-modified sheet names. The worksheet tabs can have their names changed, but it seems that Visual Basic still thinks of the worksheet names as Sheet1, etc., despite the workbook tab having been changed to something useful. I have this: TABname = rng.Worksheet.Name ' Excel sheet TAB name, not VSB Sheetx name. but I would like to use sheet names in Visual Basic routines. The best I could come up so far is to Select Case the Worksheet Tab vs. Visual Basic names, which doesn't make my day. Visual Basic must know the Sheet1, Sheet2