excel-2010

What are .NumberFormat Options In Excel VBA?

天大地大妈咪最大 提交于 2019-11-26 07:23:56
问题 Can you please let me know what are the .NumberFormat format options in Excel VBA? As you are fully aware Excel 2010 supports the following types: I know that we can set for example Text type as: .NumberFormat =\"@\" or for number: .NumberFormat = \"0.00000\" Can you please let me know what are other options for types in VBA? 回答1: Note this was done on Excel for Mac 2011 but should be same for Windows Macro: Sub numberformats() Dim rng As Range Set rng = Range("A24:A35") For Each c In rng

How to use workbook.saveas with automatic Overwrite

懵懂的女人 提交于 2019-11-26 05:27:38
问题 In this section of code, Excel ALWAYS prompts: \"File already exists, do you want to overwrite?\" Application.DisplayAlerts = False Set xls = CreateObject(\"Excel.Application\") Set wb = xls.Workbooks.Add fullFilePath = importFolderPath & \"\\\" & \"A.xlsx\" wb.SaveAs fullFilePath, AccessMode:=xlExclusive, ConflictResolution:=True wb.Close(True) Why does db.SaveAs always prompt me to overwrite existing file if I have DisplayAlerts = False ? Thanks in advance! 回答1: To hide the prompt set xls

Remove leading or trailing spaces in an entire column of data

两盒软妹~` 提交于 2019-11-26 05:14:51
问题 How do I remove leading or trailing spaces of all cells in an entire column? The worksheet\'s conventional Find and Replace (aka Ctrl + H ) dialog is not solving the problem. 回答1: If you would like to use a formula, the TRIM function will do exactly what you're looking for: +----+------------+---------------------+ | | A | B | +----+------------+---------------------+ | 1 | =TRIM(B1) | value to trim here | +----+------------+---------------------+ So to do the whole column... 1) Insert a

Get list of Excel files in a folder using VBA

故事扮演 提交于 2019-11-26 04:54:25
问题 I need to get the names of all the Excel files in a folder and then make changes to each file. I\'ve gotten the \"make changes\" part sorted out. Is there a way to get a list of the .xlsx files in one folder, say D:\\Personal and store it in a String Array. I then need to iterate through the list of files and run a macro on each of the files which I figured I can do using: Filepath = \"D:\\Personal\\\" For Each i in FileArray Workbooks.Open(Filepath+i) Next I had a look at this, however, I

Ignore Duplicates and Create New List of Unique Values in Excel

六眼飞鱼酱① 提交于 2019-11-26 03:51:34
问题 I have a column of values that often appear as duplicates. I need to create a new column, of unique values based on the first column, as follows: Column A Column B a a a b b c c c This Column B will actually need to appear on a different sheet, within the same workbook, so I assume it will need to work with the sheet2!A1 style format. I have not had any luck with the Data/Filter menu options as this only seems to work on command. I need column B to update automatically whenever a new value is

What is the difference between “Form Controls” and “ActiveX Control” in Excel 2010?

空扰寡人 提交于 2019-11-26 03:28:40
问题 Using Microsoft Excel 2010, I noticed two kind of controls that can be inserted into a document: Form Controls and ActiveX Controls . What is the difference between them? 回答1: Google is full of information on this. As Hans Passant said, Form controls are built in to Excel whereas ActiveX controls are loaded separately. Generally you'll use Forms controls, they're simpler. ActiveX controls allow for more flexible design and should be used when the job just can't be done with a basic Forms

Pop up the Excel Statusbar?

北城以北 提交于 2019-11-26 02:37:22
问题 I\'m developing an application for excel that takes a long time to run so it would be nice to have a progress bar pop up and give some indication of the progress. I was looking at the Statusbar property in Excel and it seems to cover what I need except that it\'s not very obvious i.e. it\'s a tiny little notice in the bottom left that had I not been expecting I wouldn\'t have noticed which I find quite unsatisfactory. Is there a way to have the status bar pop up in a new MsgBox style window

Loop through files in a folder using VBA?

你离开我真会死。 提交于 2019-11-25 21:39:40
问题 I would like to loop through the files of a directory using vba in Excel 2010. In the loop, I will need the filename, and the date at which the file was formatted. I have coded the following which works fine if the folder has no more then 50 files, otherwise it is ridiculously slow (I need it to work with folders with >10000 files). The sole problem of this code is that the operation to look up file.name takes extremely much time. Code that works but is waaaaaay too slow (15 seconds per 100