excel-2010

excel vba macro to match cells from two different workbooks and copy and paste accordingly

不想你离开。 提交于 2019-11-30 00:15:08
问题 i have 2 workbooks, workbook A and workbook B. Each workbook has a table. workbook A has 2 columns. All three columns are filled. product_id Machine_number and Workbook B has the same 2 columns but only one column, Product_id, is filled. The other 1 column is vacant. I need to match the cells of product_id of both workbooks. If the product_id found in workbook A matches workbook B, then the machine number of that product id should be copied from workbook A to workbook B. I have performed this

Count number of times a date occurs and make a graph out of it [closed]

回眸只為那壹抹淺笑 提交于 2019-11-29 21:14:46
I have a list of dates, each date in it can occur more than once. I want to count the number of times each date occurs (histogram) and display it in a graph (with the Y axis being the number of times the date occurs and the X axis being the date itself)? Sample list: 19/05/2012 19/05/2012 19/05/2012 17/05/2012 17/05/2012 16/05/2012 16/05/2012 16/05/2012 16/05/2012 15/05/2012 15/05/2012 15/05/2012 15/05/2012 12/05/2012 12/05/2012 12/05/2012 7/05/2012 The simplest is to do a PivotChart. Select your array of dates (with a header) and create a new Pivot Chart (Insert / PivotChart / Ok) Then on the

Put entire column (each value in column) in an array?

白昼怎懂夜的黑 提交于 2019-11-29 19:13:05
问题 So i'm making a macro to do a bunch of things. one thing is find duplicates of cells in sheet1 from sheet2. given columnA in sheet 1, do any values in columnB on sheet2 match any of the values in columna sheet1. I know theres a remove duplicates, but I just want to mark them, not remove. I was thinking something with the filtering. I know when you filter you can select multiple criteria, so if u have a column with 20 different values in it, you can select 5 values in the filter and it will

Conditional formatting: using row() inside indirect() inside and() doesn't work. What am I doing wrong?

亡梦爱人 提交于 2019-11-29 16:55:51
Say I have set a value of 55 on cell B2. If it's value is 55, the cell's background color should be green. So I created a new rule using a formula by selecting "User a formula to determine which cells to format" and set the formula to the following: =B2 = 55 It worked, obviously. But because we don't want to hard-code the row because we are using this spreadsheet as a template in an application that generates more rows by simply copying that cell to another row, I set the formula to this one: =INDIRECT( "B" & row() ) = 55 And because we actually want two conditions and our requirement is not

How to perform SumIf using VBA on an array in Excel

梦想的初衷 提交于 2019-11-29 15:42:51
问题 I'm trying to come up with the fastest way to perform a SumIf function in Excel on a dataset that has approx. 110'000 lines. I've come up with three ways, but none of them are satisfying. Here the first one I tried: Execution time on my PC 100 seconds! Sub Test1_WorksheetFunction() Dim MaxRow As Long, MaxCol As Long Dim i As Long Dim StartTimer, EndTimer, UsedTime StartTimer = Now() With wsTest MaxRow = .UsedRange.Rows.Count MaxCol = .UsedRange.Columns.Count For i = 2 To MaxRow .Cells(i, 4) =

How do you disable “Save and send” in Excel 2010 (in the File ribbon (called backstage in Office 2010)?

 ̄綄美尐妖づ 提交于 2019-11-29 15:37:20
I have the following VBA marco running in Excel 2003, it blocks the Save, Save as, Save Workspace, Send To menus but I now need to do the same but for Excel 2010 ? Application.CommandBars("Worksheet Menu Bar").Controls("File").Controls("Save As...").Enabled = False Application.CommandBars("Worksheet Menu Bar").Controls("File").Controls("Save").Enabled = False Application.CommandBars("Worksheet Menu Bar").Controls("File").Controls("Save Workspace...").Enabled = False Application.CommandBars("Worksheet Menu Bar").Controls("File").Controls("Send To").Enabled = False Application.CommandBars(

C# Excel 2010 Workbook Open error

余生颓废 提交于 2019-11-29 15:01:20
问题 We recently upgraded from Excel 2007 to Excel 2010, and we have found that existing code started failing. Exception Message: Office has detected a problem with this file. To help protect your computer this file cannot be opened. We have traced this to the line where we open the file excelApp.Workbooks.Open Even when opening the file manually, the Protected View Messagebox comes up. How can we work arround this using C#. 回答1: Have a look at using Application.FileValidation Property (Excel)

Faster way to hide empty rows

扶醉桌前 提交于 2019-11-29 14:40:59
I am trying to hide all rows where the value of the cell in Column A is blank (i.e. empty). I was trying to use the following code: Range("A7:A117").SpecialCells(xlCellTypeBlanks).EntireRow.Hidden = True However, every cell in Column A has a VLOOKUP formula and the xlCellTypeBlanks considers a cell with a formula, but no value, not to be blank. So I tried using the following code, but it is extremely slow. For i = 17 To 117 If ActiveSheet.Cells(i, 1) = "" Then ActiveSheet.Cells(i, 1).EntireRow.Hidden = True End If How do I speed it up? Why don't you try AutoFilter: Range("A7:A117").AutoFilter

Using COUNTIFS to count blank when cell has a formula

孤街浪徒 提交于 2019-11-29 14:29:34
问题 I have criteria where I need to count if a column B is not blank. But I have a formula in Cell B, So if I do a simple =Countifs(B1:B10,"<>") This returns the count of the cells which have the formula but I just need the blanks when the formula does not populate anything. 回答1: Try this formula [edited as per comments] To count populated cells but not "" use =COUNTIF(B:B,"*?") That counts text values, for numbers =COUNT(B:B) If you have text and numbers combine the two =COUNTIF(B:B,"*?")+COUNT

How to put user defined datatype into a Dictionary

我的梦境 提交于 2019-11-29 12:18:12
问题 I'm trying to define my own data type and put it in a Dictionary as a value. VBA complains that it does not accept my data type. Any ideas about how to get this working? Option Explicit Public Type Translation german As String french As String italian As String End Type Private resource As Object Public Sub addTranslation(key As String, g As String, f As String, i As String) Dim trx As Translation trx.german = g trx.french = f trx.italian = i resource.add key, trx '<== here VBA is complaining