excel-2003

VBA How to copy the content of a cell without .Select

只谈情不闲聊 提交于 2020-01-22 11:42:08
问题 I am writing a method that can take the Target and paste the cell exactly to another cell. The cell is a shipping label with some fancy formating. Is there a way I can do it? Originally I have this: Worksheets("Label").Range("A1").Value = Worksheets("Get Address").Range("A28").Value It worked for the plain text. However I lost the styling I created, they are different because after the first line, the style is different: I also tried to use Macro Recorder and I got a solution using .Select ,

Wrapping IF ISERROR around INDEX function

折月煮酒 提交于 2020-01-07 09:18:29
问题 I have a problem with a dynamic list in Excel 2003 where some cells that I want to be empty are returning #NUM! . I have tried manipulating the following code, but to no avail: =IF(ISERROR(INDEX(venue_name, SMALL(IF(($A$10=date_ns)*(COUNTIF($A$13:A29,venue_name)=0), ROW(date_ns)-MIN(ROW(date_ns))+1, ""), 1))) I know its something to do with syntax/parentheses but have exhausted myself trying different combinations. Without the IF(ISERROR( and the closing bracket, the code runs absolutely fine

Take data from all books to some table

我是研究僧i 提交于 2020-01-06 08:07:17
问题 I am very new in EXCEL (especially in VBA). I try to write logic that: go to all open books, if some book has sheet with name "Test", it should take data from named range "Table" and then append it to the Table1 from sheet ALLDATA in book ALLDATABOOK. I try to write this, can someone help me? Here is my code: Private Sub CommandButton1_Click() Dim book As Object Dim lst As ListObject Dim iList As Worksheet For Each book In Workbooks For Each iList In book.Sheets If iList.Name = "Test" Then

Deleting Duplicates with VBA - Excel 2003

空扰寡人 提交于 2020-01-05 12:08:28
问题 I was wondering if anyone would know of any VBA code that would get rid of duplicates. For example, in Column D, I want to keep the first instance of the ID, and get delete the duplicate(s). Regards Greg 回答1: Ok, that should work for you. That Routine delets all double Id'd in the Column C Option Explicit Sub DeletDuplicate() Dim x As Long Dim LastRow As Long LastRow = Range("C65536").End(xlUp).Row For x = LastRow To 1 Step -1 If Application.WorksheetFunction.CountIf(Range("C1:C" & x), Range(

Excel 2003 VBA: Move a sheet into a new workbook that is referenced by a variable

微笑、不失礼 提交于 2020-01-04 05:45:10
问题 I have a function that is meant to run the ShowPages() command of a PivotTable and then save each sheet to a separate file. Here's how I wish I could do it: Sub Split() ThisWorkbook.Sheets("Data").PivotTables("Data").ShowPages PageField:="Codename" Dim newWb As Workbook For Each s In ThisWorkbook.Sheets If s.Name <> "Data" Then Set newWb = s.Move #This is the line I'm trying to work out newWb.SaveAs Filename:="C:\Export\" + s.Name + ".xls" newWb.Close End If Next s End Sub Unfortunately, this

Why can't I set Application.ReplaceFormat.NumberFormat to some valid formats?

人盡茶涼 提交于 2020-01-03 19:23:12
问题 I'm trying to use an Excel Macro to reformat a spreadsheet exported using OLE-Automation The following code works OK: Application.FindFormat.NumberFormat = "#,##0.0000000" Application.ReplaceFormat.NumberFormat = "#,##0.00" Cells.Replace What:="", Replacement:="", LookAt:=xlPart, SearchOrder:= _ xlByRows, MatchCase:=False, SearchFormat:=True, ReplaceFormat:=True if I change the ReplaceFormat to Application.ReplaceFormat.NumberFormat = "#,##0.0" to display only 1 decimal place, I get an error

How to get screen X and Y of an Excel 2003 cell in C#

送分小仙女□ 提交于 2020-01-03 05:02:47
问题 How can I find the absolute position of a cell in Excel 2003 (e.g. relative to the screen[s]) when writing a C# Excel 2003 Add-in. The Top and Left properties of a Range (such as ActiveCell) seem to give the X and Y relative to the top-left hand cell. Window.Left and Top give the X and Y of the window, but I can't find a way to get the size of the bit in the middle (consisting of Toolbars and such). The aim here is to display a WPF form that relates to the selected cell, and is positioned

Count number of worksheets in Excel File

点点圈 提交于 2020-01-02 10:19:15
问题 How to count number of worksheets in a Microsoft Excel file using Java SE? 回答1: There's no standard class/library files in Java SE that interfaces with MS Excel. In Apache POI, you can use HSSFWorkbook.getNumberOfSheets() method which returns you the number of worksheet from a workbook. To open an Excel file and get HSSFWorkbook , do this: String fileName = "C://Excel.xls"; POIFSFileSystem fileSystem = new POIFSFileSystem(new FileInputStream(fileName)); HSSFWorkbook workbook = new

Count number of worksheets in Excel File

北慕城南 提交于 2020-01-02 10:18:15
问题 How to count number of worksheets in a Microsoft Excel file using Java SE? 回答1: There's no standard class/library files in Java SE that interfaces with MS Excel. In Apache POI, you can use HSSFWorkbook.getNumberOfSheets() method which returns you the number of worksheet from a workbook. To open an Excel file and get HSSFWorkbook , do this: String fileName = "C://Excel.xls"; POIFSFileSystem fileSystem = new POIFSFileSystem(new FileInputStream(fileName)); HSSFWorkbook workbook = new

Is there a macro to conditionally copy rows to another worksheet?

梦想与她 提交于 2020-01-02 07:20:16
问题 Is there a macro or a way to conditionally copy rows from one worksheet to another in Excel 2003? I'm pulling a list of data from SharePoint via a web query into a blank worksheet in Excel, and then I want to copy the rows for a particular month to a particular worksheet (for example, all July data from a SharePoint worksheet to the Jul worksheet, all June data from a SharePoint worksheet to Jun worksheet, etc.). Sample data Date - Project - ID - Engineer 8/2/08 - XYZ - T0908-5555 - JS 9/4/08