worksheet

Set header in Excel for worksheet 2

偶尔善良 提交于 2019-12-11 04:56:25
问题 I habe some problems with setting the header for my worksheet 2 Here is my code: Excel.Application xlApp1 = new Excel.Application(); Excel.Workbook xlWorkBook; Excel.Worksheet xlWorkSheet1 = new Excel.Worksheet(); Excel.Worksheet xlWorkSheet2 = new Excel.Worksheet(); object misValue = System.Reflection.Missing.Value; xlWorkBook = xlApp1.Workbooks.Add(misValue); xlWorkSheet1 = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1); // Sheet1 xlWorkSheet1.Name = "XX"; xlWorkSheet2 = (Excel

Excel VBA - Automation Error during loop

隐身守侯 提交于 2019-12-11 04:37:22
问题 Hello there fellow StackOverflow users, So my issue is with a workbook that heavily uses VBA to automate and calculate several functions. However the one in particular is a function I wrote that updates the code and named ranges of the workbook when the master copy is updated, which is done simply by a version number in a cell check. Function updateCheck(cVer As Double) As Double Dim currWB As Workbook, isWB As Workbook, iSht As Worksheet, ver As Range, wbName As String, path As String Dim

Export a single worksheet to a new workbook using VBA and a button

情到浓时终转凉″ 提交于 2019-12-11 04:24:37
问题 I have a worksheet that has a button, once clicked it will export that sheet into a new workbook and allow the user to save the new workbook to their specified location. Before upgrading to excel 2016 this code worked fine, but now it's hitting my error handler. I am fairly new to VBA and did not create this code to begin with, so I am not sure if there is an easier way or if I just need to enter a new case for 2016 users and what that new code should say. Here is the current code: Private

How to copy a range from one sheet to another as values using openpyxl in python

心已入冬 提交于 2019-12-11 03:27:29
问题 I have to copy a range from A1:Z100 from sheet onw of workbook 1 to sheet 1 of workbook 2? My code : wb = openpyxl.load_workbook('file1.xlsx') wb1 = openpyxl.load_workbook('file2.xlsx') sheet = wb["R"] sheet1 = wb1["Rt"] sheet1.cell(row=1,column=1).value = sheet.cell(row=1,column=1).value This is not working properly. How to copy this range to that sheet? 回答1: You can try with something like: for i in range(1, 100): for j in range(1, 26): sheet1.cell(row=i,column=j).value = sheet.cell(row=i

Why worksheet Id changing after reopening document (Excel javascript API )?

风格不统一 提交于 2019-12-10 23:45:23
问题 In my Excel tab-pane addin after adding worksheet(manually/programmatically) and running code below I have worksheet object where id is "{040E0F18-0F61-4CD9-886D-95112C925793}", then I save workbook, close and open again, run code below and it shows me that the worksheet.id now is "{00000000-0001-0000-0000-000000000000}"! In office.js reference about worksheet id: The value of the identifier remains the same even when the worksheet is renamed or moved. Read-only. Excel.run(function (ctx) {

How do I “sheetwise” save or export an Excel workbook as a PDF file?

老子叫甜甜 提交于 2019-12-10 22:19:37
问题 The problem with the code I have is that either it saves all the pages in all the worksheets in the workbook or it saves only the pages in the range specified by the "from" and "to" arguments. The excel files I am working with have 7 worksheets, and each worksheet can have any amount of pages. If I specify that I want to export "from 1 to 4", for example, then only the first 4 pages of the first worksheet would be exported as a PDF document, not all the pages of the first 4 worksheets. Can

VSTO: Drawing on top of Excel worksheet

梦想的初衷 提交于 2019-12-10 19:34:02
问题 I've written a bunch of handy Excel add-ins in C#, and everything works great. But the one thing I haven't been able to figure out is if it's possible to place graphics (bitmaps, shapes, whatever) on a worksheet control, e.g. by appending a function to its paint event handler. I don't want to actually change the document in any way, it's only for temporarily highlighting things to indicate how my add-ins are finding and interpreting data in the sheet. The simplest thing I want to be able to

How do ActiveSheet, ActiveWorkbook.ActiveSheet and Application.ActiveSheet behave differently?

帅比萌擦擦* 提交于 2019-12-10 19:28:16
问题 I am in the habit of of always using ActiveSheet like this: ActiveWorkbook.ActiveSheet . I recently stumbled across this Microsoft page with code that includes ActiveSheet without ActiveWorkbook . The title of that page is Application.ActiveSheet Property. Is there a difference between these three lines of code? ActiveSheet ActiveWorkbook.ActiveSheet Application.ActiveSheet 回答1: These all refer to the same thing the active sheet , but the context may not be as expected. ActiveSheet is the

'With Worksheets(“xxxx”)' works only when “xxxx” is the active worksheet

别说谁变了你拦得住时间么 提交于 2019-12-10 19:11:32
问题 I'm pretty new to Excel VBA. So far I've read and learned a lot on this site, but haven't found a solution for my problem. As part of a macro I have the following code: With Worksheets("Oracle") On error resume next ActiveWorkbook.Names("bron").Delete ActiveWorkbook.Names.Add Name:="bron", RefersTo:= Range("A1", Range("A1").End(xlToRight).End(xlDown)) .Cells.Select With Selection.Font .Name = "Verdana" .FontStyle = "Standaard" .Size = 8 End With .Range("A1", Range("A1").End(xlToRight)).Font

Excel won't show the workbooks worksheets

冷暖自知 提交于 2019-12-08 19:09:01
问题 I have an Excel Workbook containing three worksheets. However all sheets seem to be hidden dispite that their visibility is set to xlSheetVisible (Found by looking at the worksheet properties in the VBA editor). This is what I have tried so far to solve the problem. Searched Google for help, but all similar problems have been solved by changing the Visibility from xlSheetHidden to xlSheetVisible. But in my case that setting is already set to xlVisible. By using VBA I have tried to activate a