excel-2007

How to remove a particular word in an Excel cell?

狂风中的少年 提交于 2019-12-22 14:05:03
问题 How do you remove a particular word in a column of one cell that's in another cell in Excel. Example: if A1 = *1603 Ad street New York* , B1 = *New York* then in C1 I want = *1603 Ad street* 回答1: Use the Substitute function: =SUBSTITUTE(A1,B1,"") EDIT: Per brettdj's suggestion, added TRIM to get rid of leading or trailing spaces: =TRIM(SUBSTITUTE(A1,B1,"")) 回答2: Just use the Replace function. leave " replace with" blank 回答3: Try this formula for range of words: =TRIM(SUBSTITUTE(A1,INDEX($B$1:

Reference variable worksheet in VLOOKUP vba

▼魔方 西西 提交于 2019-12-22 12:03:19
问题 I am writing a macro that creates variable worksheets based on a value on an existing worksheet. I managed that part fine, but now I need to add a VLOOKUP formula on another sheet that references the newly created sheets. There is no set pattern to the name of the new worksheets, so I having trouble referencing them. Here is the code I used to create the new worksheets: Dim ws As Worksheet Dim rngCriteria As Range Dim sName As String Dim I As Long Dim LastRow As Long LastRow = Cells(Rows

Reference variable worksheet in VLOOKUP vba

可紊 提交于 2019-12-22 12:03:04
问题 I am writing a macro that creates variable worksheets based on a value on an existing worksheet. I managed that part fine, but now I need to add a VLOOKUP formula on another sheet that references the newly created sheets. There is no set pattern to the name of the new worksheets, so I having trouble referencing them. Here is the code I used to create the new worksheets: Dim ws As Worksheet Dim rngCriteria As Range Dim sName As String Dim I As Long Dim LastRow As Long LastRow = Cells(Rows

Error reading xlsx (2007) file in EPPLUS

跟風遠走 提交于 2019-12-22 10:34:04
问题 I have an error while trying to read excel files ( xlsx ) which were saved in Excel 2007 using EPPlus library. Some workaround: ASP.net mvc 5 app with EPPlus v. 4.0.4.0 User can download template file from my site, then fill required data in it, and upload it back. File contains 4 worksheets, one of them is hidden . Workbook is password protected, worksheets are proteced too. All of them have different passwords. Template file ( xlsx ) produced in Excel 2007 or 2010 . When user posts file

How to assign certificates to excel macros programmatically

徘徊边缘 提交于 2019-12-22 10:28:58
问题 I have developed some code which creates excel macros and each time after creation of new macro I want to digitally sign the macro programmatically. Can you let me know if there is any way using which I can create new digital certificates and assign those to macro programmatically. Thanks. 回答1: It is not possible to do this with VBA code. I think the best you could hope to do it would be by making Win32 API calls to simulate all the needed steps to make this happen. It would be sloppy but you

Exporting Some Sheets from Excel Workbook to PDF

天大地大妈咪最大 提交于 2019-12-22 09:57:29
问题 I am working on writing a VBA code to export some of the sheets in excel to same PDF. I have several chart sheets in my excel file each of which name ends with "(name)_Chart". I want to export all sheets with names ending wioth chart to one PDF file. Here is the code I am trying to write. Sub FindWS() 'look if it at least contains part of the name Dim s As Worksheet Dim strPath As String strPath = ActiveWorkbook.Path & "\" For Each s In ThisWorkbook.Sheets If InStr(1, s.Name, Chart) Then s

Using an OR condition to filter an Excel Pivot Table

不羁的心 提交于 2019-12-22 09:14:32
问题 I'm an Excel amateur and I'm just starting to learn to use Pivot Tables. The issue is, I need the pivot table filtered results to be inclusive. So, I have a table with some data rows and 3 Columns A, B, C with possible values X, Y, Z... I specify a filter for columns A, B, C such as that I can retrieve the data rows that have A=Y OR B=Z OR C=X. The problem I have is that the default filters use an AND condition. So if I select the first value as A=Y, it will remove all other rows. Any ideas?

Is there a way to capture HotKeys/Shortcuts in Excel VSTO using only C# and no VBA?

混江龙づ霸主 提交于 2019-12-22 04:44:16
问题 So I want to capture some key-commands in our Docuement-level Excel VSTO addin. I can't seem to find a way to do it, other than to use VBA and have our addin talk to the VBA. Any help/examples would be greatly appreciated. I am using Excel 2007. 回答1: You can only do this through API calls to subclass Excel and watch for key commands. This is older, but it still applies. 回答2: One method involves using the 3rd party solution from Addin-Express . Their product includes the ability to add a

VBA Solver disabling the dialog box that pops after each iteration

﹥>﹥吖頭↗ 提交于 2019-12-21 20:52:20
问题 I am using the built-in solver in Excel 2007 within a VBA loop to solve a number of different problems. Occasionally, the solver hits the maximum time, which causes a pop-up dialog box to appear asking whether the user wants to Continue, Stop, or End. In all cases I want it to end, and proceed to the next line of the loop. This will prevent a user from having to sit there and respond each time. I ran a macro with the solver pass thru method (Catch max time/iteration dialog box when using

Call regex in an Excel cell

拜拜、爱过 提交于 2019-12-21 20:14:57
问题 I want to extract a string from a cell using a regex match. I can't find the excel function that does it and I'm no VBA expert either. I use Excel 2007. 回答1: In the Excel VBA code editor select Tools/References. In the picker check the latest version of Microsoft VBScript Regular Expresions. Here is a simple user defined function to get you started. This will return "foo" if you point it at a cell with "foobar" or "fooooobar" in it. Function RegExtract(contents As String) Dim regx As RegExp