excel

Webscrap VBA - List

余生长醉 提交于 2021-01-29 18:31:17
问题 I am trying to set up a webscrapping VBA code to import data into Excel from this website: https://www.thewindpower.net/windfarms_list_en.php I wish to launch this webpage, select a country and then scrap the data from the table below (including url from the name column). Yet, I am stuck with several points: How can I select the country I wish in VBA code ? How can I select the table as there is no id or class in the tag ? How can I import the URL included in the name column ? Here is the

Excel VBA sort Listbox data if not numeric to bottom

ⅰ亾dé卋堺 提交于 2021-01-29 18:30:33
问题 I am using the below code to sot my Listbox data numerically. I use the following IF statement to check if data is numeric (some data is not): If IsNumeric(.List(i, 4)) And IsNumeric(.List(j, 4)) Then My Listbox data is sorted correctly. However because of the above IF statement the sorting process ignores non-numeric data. I need to sort the non numeric data to the bottom of the Listbox. Public Sub BubbleSort() Dim i As Long Dim j As Long Dim Temp4 As Variant, Temp3 As Variant, Temp2 As

How to pivot duplicate rows to columns?

*爱你&永不变心* 提交于 2021-01-29 18:30:30
问题 having a hard time figuring out how to pivot a multi-column data set with duplicate rows into unique columns. I have done research and found some VBA scripts to do this, but it is resulting in data missing when I do counts to confirm it pivoted correctly and ends up adding in duplicate columns (name/ rating year) over and over. Anyone have any ideas? I'd do a pivot table, but I can't display the actual rating values in a pivot, only a sum/count/avg. etc... 回答1: You can do this easily in

Capture visible values from filtered range from a particular column in an array

空扰寡人 提交于 2021-01-29 18:28:27
问题 Description : I have a sheet with about 30 columns and more than 500k rows on average (there are multiple files). Column 8 of the sheet holds filenames. I am applying filter on this column to only display rows with filenames that I want to see Goal : After applying the filter, I want to capture all visible rows in column 8 into an array. This is the bit I'm struggling with Code : Sub GetFilteredColumn() Dim oWS As Worksheet: Set oWS = ThisWorkbook.Worksheets("Sheet1") Dim iLRow As Long, iRow

Convert date and time to ISO yyyy-mm-dd in Excel

空扰寡人 提交于 2021-01-29 18:26:19
问题 In a csv file which I have opened in Excel date is formated like "2014-08-28 09:03:19.789". How can the above be converted to just yyyy-mm-dd (2014-08-28) in Excel? I have tried to set the column to yyyy-mm-dd but it does not change. 回答1: What version of Excel are you using? (I'm not sure if that matters.) If you tried just typing yyyy-mm-dd in the format selector box that will not work. You need to open the custom format dialog and type in yyyy-mm-dd as a new format there. 回答2: Use the Text

Get the Nth index of an array in VBA

谁说我不能喝 提交于 2021-01-29 18:21:52
问题 I am a noob in VBA and can't find a way to get the element of an array at a given index... It might be easy for you, though. I have an excel file with 2 columns, "Emails" and "Categories", and I want to filter out all emails for a given category. I ended up so far with the following code: Sub filterEmails() Dim tbl As ListObject Dim emails As Variant Dim email As String Dim categories As Variant Dim category As String Dim i As Integer Set tbl = ActiveWorkbook.Worksheets("Feuil1").ListObjects(

C# - Excel - How to delete visible rows after AutoFilter?

十年热恋 提交于 2021-01-29 18:00:40
问题 I´m working on a little commandline tool to extract some data from an excel sheet. I want to delete all rows which are visible after applying an AutoFilter. Unfortunately, I just don´t know how to continue. After some searching, I did not find a working answer for me. Here is what I´ve got so far: oXL = new Excel.Application(); oXL.Visible = false; oWB = oXL.Workbooks.Open(source); oXS = (Excel.Worksheet)oWB.Sheets[1]; Excel.Range filter = oXS.UsedRange; filter.AutoFilter(8, "<>text to filter

How to concatenate cell (row wise) in excel till a value is found?

╄→гoц情女王★ 提交于 2021-01-29 17:58:24
问题 I have data in MS excel sheet as : Row Column A 1 AAA Number of ABC 2 Streaming Call 3 Explanation 4 BBB Number of ABC 5 Streaming Call 6 from source 7 Explanation 8 CCC Number of ABC 9 Streaming Call 10 from source 11 to Dest 12 Explanation ... ... 196000 Explanation I want to keep concatenating cell of column A in column B, till the cell value is "Explanation" : 1 AAA Number of ABC AAA Number of ABC 2 Streaming Call AAA Number of ABC Streaming Call 3 Explanation Explanation 4 BBB Number of

VBA code to know URL validity that will check whether URL is exist or not

你离开我真会死。 提交于 2021-01-29 17:49:01
问题 I have code to know the URL existence but in many other systems or may another office version it is not working. could please help me with this? Where is im doing wrong? Is there an alternate option? Thanks in advance I am using code to know URL VALIDITY is Public Function IsURLGood(URL As String) As Boolean Dim request As New WinHttpRequest On Error GoTo IsURLGoodError request.Open "HEAD", URL request.send If request.Status = 200 Then IsURLGood = True Else IsURLGood = False End If Exit

How to insert array formula in an Excel sheet with openpyxl?

孤街醉人 提交于 2021-01-29 17:37:57
问题 I'm using OpenPyxl to create and modify an Excel sheet. I have the following formula in Excel : =(SUM(IF(LEFT(Balances!$B$2:$B$100,LEN($B4))=$B4,Balances!$D$2:$D$100))) This formula which is an "array formula" is working but in order to write it by hand, I have to finish with CTRL+SHIFT+ENTER (because it's an array formula). This transform then the formula as follow : {=(SUM(IF(LEFT(Balances!$B$2:$B$100,LEN($B4))=$B4,Balances!$D$2:$D$100)))} I want to be able to write this formula via