excel

How to read the entire worksheet from excel

扶醉桌前 提交于 2021-01-29 07:40:54
问题 I am reading data from numerous excel worksheets, but the performance is slow since I am fetching each col directly. Is there a way I can read the entire UsedRange into memory with one call? Then process the rows/cols locally? The code I have is basically this: xlWorkSheet = (Worksheet)_xlWorkBook.Worksheets.get_Item(1); var range = xlWorkSheet.UsedRange; for (var rCnt = 2; rCnt <= range.Rows.Count; rCnt++) { // Process column entries } 回答1: I had the same problem while handling very large

Remove duplicates in VBA Combobox

与世无争的帅哥 提交于 2021-01-29 07:33:23
问题 I have the below code to populate a listbox, therefore I want to remove duplicates from my combobox. I Don't know how to do it: Private Sub CommandButton1_Click() Dim ws_suivi As Worksheet Set ws_suivi = ActiveWorkbook.Worksheets("suivi") Fin_Liste_suivi = ws_suivi.Range("A65530").End(xlUp).Row For i = 2 To Fin_Liste_suivi UserForm_SDE.ComboBox_Type_Rapp.AddItem ws_suivi.Range("AD" & i) Next UserForm_SDE.Show End Sub 回答1: It is often worth searching to see if a Library for VBA exists that

Search by subject for latest email in all folders and reply all

别等时光非礼了梦想. 提交于 2021-01-29 07:29:36
问题 The code below doesn't execute reply all property, hence, I am not able to edit the body of the email and keep the conversation of the email chain. I think the best option is to use Application.advancesearch as it gives you latest email by searching through all folders. But I do not know how to run it through Excel. Objective: 1) Search the inbox and subfolders (multiple) and Sent items folder for the latest email for selected "Subject" 2) select the latest email and reply to all Sub

Folder Picker Excel VBA & paste Path to Cell

情到浓时终转凉″ 提交于 2021-01-29 07:23:26
问题 I am having difficulty figuring out how to put the Folder Path in Cell C49. I'd like to have the Path there for the User to understand where they are searching and if they have to change said Path. I got this VBA code from, http://learnexcelmacro.com/wp/2016/12/how-to-open-file-explorer-in-vba/ Private Sub cmd_button_BROWSEforFolder_Click() On Error GoTo err Dim fileExplorer As FileDialog Set fileExplorer = Application.FileDialog(msoFileDialogFolderPicker) 'To allow or disable to multi select

In Excel, how do I make a stacked bar graph with 2 bar that have different data points?

独自空忆成欢 提交于 2021-01-29 07:22:52
问题 So I have the following data: I made 2 stacked bars with these data, notice both bar have different data points, my question is, how do I merge them to the same graph so I can compare them? I would like something to look like this, is it possible?: 回答1: A simple solution would be to have all 7 columns in your data table, and then fill in 0's for the values that don't apply to one row or the other. 来源: https://stackoverflow.com/questions/20056758/in-excel-how-do-i-make-a-stacked-bar-graph-with

Bulk Email Extractor. Need to add a Regxp - excel VBA

安稳与你 提交于 2021-01-29 07:21:23
问题 I am trying to update my first code with parts of a second code, but have been struggling for a few weeks now. Both codes extract emails from a url list. THE FIRST CODE This code is fine apart from it uses Mailto: rather than a Regxp . I am trying to replace the Mailto: in the first code with a Regxp from the second code as the regxp extracts more emails. How the First code works. A list of urls are placed in Sheet2 "Urls" and the results are show in Sheet1 "Results" . This code will extract

Underline property of textbox not working like the others

百般思念 提交于 2021-01-29 07:21:12
问题 I simply want to underline some text in a worksheet textbox using VBA, from a specific character to another. It should be extremely simple, and I can do it without problem with Bold and Italic. I have the following sub Sub ew() Dim txt1 As Shape Set txt1 = Sheet1.Shapes("txt_1") txt1.TextFrame.Characters.Text = "Bold and Underline this" txt1.TextFrame.Characters.Font.Bold = True txt1.TextFrame.Characters.Font.Italic = True txt1.TextFrame.Characters.Font.Underline = True End Sub The code fails

Merging Multiple Worksheets To Single Worksheet In Different Workbook

拥有回忆 提交于 2021-01-29 07:21:08
问题 I want to copy all the rows and columns in multiple worksheets in a one workbook to a single worksheet in a different workbook. In addition, I just want to copy the header once, even though it is in all of the worksheets I'll copy. I can open the workbook containing all of the worksheets I want to copy to my destination worksheet/workbook however, I don't know how to copy the header only once and often get a Paste Special error. Sub Raw_Report_Import() 'Define variables' Dim ws As Worksheet

Excel rank formula issue

本秂侑毒 提交于 2021-01-29 07:20:21
问题 Formula RANK(F2,$F$2:$F$5) Output: **sr rank name sub1 sub2 sum percentage** 1 1 jaydeep 60 65 326 163 2 1 manish 70 63 326 163 3 3 jay 60 65 325.5 162.75 Want: In rank column I get 3rd rank but actually it is 2nd rank. Any way to get 2nd rank using formula because of sheet contain many data. Thanks. 回答1: What I think you want is called a Dense Rank Try this formula: =SUMPRODUCT( (FREQUENCY($F$2:$F$4,$F$2:$F$4) > 0) * (F2 <= $F$2:$F$5) ) Note that range within the FREQUENCY function is the

Excel VBA to Login to Website and Grab TR & TD Elements

試著忘記壹切 提交于 2021-01-29 07:13:13
问题 I am testing the code below. I think this is very close, but I can't seem to login to the site for some reason. Sub Website_Login_Test() Dim oHTML_Element As IHTMLElement Dim sURL As String On Error GoTo Err_Clear sURL = "https://login.my_site_here.jsp?" Set oBrowser = New InternetExplorer oBrowser.Silent = True oBrowser.timeout = 60 oBrowser.navigate sURL oBrowser.Visible = True Do ' Wait till the Browser is loaded Loop Until oBrowser.readyState = READYSTATE_COMPLETE Set HTMLDoc = oBrowser