excel-2010

Deleting Sheet with VBA crashes Excel

佐手、 提交于 2019-12-08 05:31:49
问题 I am trying to delete a worksheet when the user click's on an image (button) in Excel. However this makes excel crash and restart, forgetting any unsaved progress. This is my sub: Sub DeletePlan() Application.Calculation = xlCalculationManual Application.DisplayAlerts = False Dim SheetNamesToCopy As String SheetNamesToCopy = ActiveSheet.Name ' Check what addon sheets exists for the media, then add existing ones to string If CheckSheet("periodeplan", True) = True Then ThisWorkbook.SheetS

VBA - Excel - Save As and delete original workbook

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-08 04:23:47
问题 From a Personal.xlsb file, I want VBA to save the current active workbook as a user-definable name in the same directory and delete the original workbook. Below is my code. It has two problems. One, it saves the workbook in My Documents folder for some reason. The active workbook is not in My Documents. It's in a folder in a completely different drive. Two, it throws a "File not found" error. Sub RenameFile() Dim thisWb As Workbook Set thisWb = ActiveWorkbook MyOldName = ActiveWorkbook.Name

excel array formula: not have to 'ctrl-shift-enter'? [closed]

戏子无情 提交于 2019-12-08 03:56:51
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 7 years ago . After you press f2 to edit an array formula e.g. {=MATCH(TRUE,(B2:B100)>0,0)}, the curly brackets disappear of course. After editing, you have to press ctrl + shift + enter to make the curly brackets reappear. Is there some setting to keep the {} even if you press a normal ‘enter’? Also after copying the cell

Excel VBA DataObject:PutInClipboard Not Implemented

北城余情 提交于 2019-12-08 03:35:31
I maintain an Excel workbook with a bunch of VBA macros in it. The workbook has been in use for the past few months, mostly without any incident. We have a VBA function that is used to call other VBA functions. The purpose of it is to back up clipboard data, run the function, then restore clipboard data. It's pretty simple. Sub FunctionHandler() Dim clipboardData As New DataObject clipboardData.GetFromClipboard '' There are a dozen or so macros that can be called here Call AnyFunction() On Error Resume Next clipboardData.PutInClipboard On Error GoTo 0 End Sub The VBA project includes a

Controlling Excel workbook from Access 2010 VBA

ぐ巨炮叔叔 提交于 2019-12-08 03:31:34
问题 I have a situation very similar to the following post: Access query to excel 2010 to create a graph via vba In my case, I export a table, but I want to do a lot more to the Excel file. First I want to rename the tab on the first sheet of the Excel file, since it exports with the funky table name. So, instead of "tblThisIsMyTable", I'd like to change it to "MyTable as of (add a date variable here)" Secondly, I need to create a Pivot table and make a copy of the Pivot table on another tab, to

Automatically updating Data Validation lists based on user input

不打扰是莪最后的温柔 提交于 2019-12-08 03:10:30
问题 I have a very large data set (about 16k rows). I have 10 higher level blocks and within each block I have 4 categories (10 rows for each) which use Data Validation lists to show items available in each category. The lists should automatically update based on user input. What I need your help with is that I want to use the same data set for each block and preferably a least calculation/size intensive approach. I have put together a sample file that outlines the issue with examples. Sample File

Matching function of a regular expression in excel?

◇◆丶佛笑我妖孽 提交于 2019-12-08 03:06:11
问题 I have several cells in my sheet which contain an ISIN. Here is an example of an ISIN: DE0006231004 I have created a regular expression which matches the ISIN: ^[a-zA-Z]{2}[0-9]{10}$ I want to match this regex on my cell and give a 1 if it matches otherwise a 0. Is this possible with a function? 回答1: The following function will do what you need. It will return either 0 (zero) if string doesn't match or 1 (one) if the string matches to pattern. Function MatchISIN(ISIN As String) Dim regEx As

For loops being skipped without cause in VBA

血红的双手。 提交于 2019-12-08 02:56:25
My code, as written, works for all the ways I've tested it. I have two questions though. First, Why in the blue blazes do I HAVE to use Do While loops instead of For loops in my code? I've searched Everywhere I can to help me on this issue. I can't reinstall excel, but I've reset as many of the settings as I can, but, invariably, the compiler skips over every for loop I have that isn't a for each loop... Except the first for loop in my programming... It is the weirdest and most bizarre behavior I have ever seen. I have used step through (F8) 10000 times to try and figure out why it keeps

Why does ActiveSheet.FilterMode returns False when sheet has filter?

眉间皱痕 提交于 2019-12-08 02:21:33
问题 I'm using the following code in an attempt to detect a filter applied to a column in a table and then clear the filter: If ActiveSheet.FilterMode Then ActiveSheet.ShowAllData According to Microsoft documentation: This property is true if the worksheet contains a filtered list in which there are hidden rows. This doesn't seem to be the case since ActiveSheet.Filtermode only returns True if a cell inside the table where the filter is applied is selected. First question: Is the documentation

Why do some (but not all) Conditional Formatting “split” upon inserting rows intersecting them? [closed]

雨燕双飞 提交于 2019-12-08 01:28:36
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . A quick look around the Internet and you can easily notice a common problem: Conditional Formatting in Excel (2010) are often split when inserting rows that intersect the area they're formatting. However, this "splitting" isn't consistent: What requirement does a Conditional Formatting rule need to following in