excel

Can closedXML write out an HTML table for Excel

心不动则不痛 提交于 2021-01-28 13:54:54
问题 I have an HTML table that is dynamic and has tags: table, th, thead, td, tbody, tr and a div at the end It also has colspans too. Can closedXML just import this into a worksheet as is and render it out as XML? 回答1: No, ClosedXML can not import HTML. You have to parse the HTML yourself (using something like HTML Agility Pack) and put the content of each cell in the HTML table in the corresponding cell of the ClosedXML spreadsheet. 来源: https://stackoverflow.com/questions/23257900/can-closedxml

VBA: How do I get unique values in a column and insert it into an array?

老子叫甜甜 提交于 2021-01-28 13:39:03
问题 I have seen multiple codes regarding this topic but I can't seem to understand it. For instance, if I have a column that records people names, I want to record all unique names into the array. So if I have a column of names David Johnathan Peter Peter Peter Louis David I want to utilize VBA to extract unique names out of the column and place it into an array so when I call the array it would return these results Array[0] = David Array[1] = Johnathan Array[2] = Peter Array[3] = Louis 回答1:

Loop through sheets creating graphs

徘徊边缘 提交于 2021-01-28 13:34:44
问题 Im setting up a workbook that needs weekly updates. It contains 10 sheets and im trying to create a loop that makes a graph for each sheet. I tryed a loop with sh.activate, that ended up creating a graph with the data from worksheet1 in all the worksheets. After this i tried to create a look without .activate it doenst work though Is this the correct way to do it? Sub graph() Dim ws As Worksheet Dim chrt As Chart Dim StartCell As Range For Each ws In Worksheets Set StartCell = .Range("e1")

Loop through sheets creating graphs

筅森魡賤 提交于 2021-01-28 13:34:43
问题 Im setting up a workbook that needs weekly updates. It contains 10 sheets and im trying to create a loop that makes a graph for each sheet. I tryed a loop with sh.activate, that ended up creating a graph with the data from worksheet1 in all the worksheets. After this i tried to create a look without .activate it doenst work though Is this the correct way to do it? Sub graph() Dim ws As Worksheet Dim chrt As Chart Dim StartCell As Range For Each ws In Worksheets Set StartCell = .Range("e1")

Excel vba Translate IE.Document empty

不羁岁月 提交于 2021-01-28 13:00:44
问题 This is a VBA script i am using to translate fields in a excell sheet. The problem is that the script works for me about 2 3 month ago, but now the IE.Document is empty after translating. The page comes up with correct translation but i can't get the result inside my excel sheet inputstring = "en" outputstring = "da" text_to_convert = str 'open website IE.Visible = True IE.navigate "https://translate.google.com/#" & inputstring & "/" & outputstring & "/" & text_to_convert Do Until IE

Return a value from a userform

那年仲夏 提交于 2021-01-28 12:53:45
问题 I am trying to return a value from a userform to another macro. Here is an example of a piece of code that I want to return the value intMonth : sub comparison() UserForm1.Show end sub then I have the userform code: Private Sub initialize() OptionButton1 = False End Sub Private Sub OptionButton1_Click() intMonth = 1 Me.Hide End Sub How do I get the intMonth value of 1 back to my original comparison() function? 回答1: This is a minimal example, but should help. In the UserForm: Option Explicit

mapping column headers from one sheet to another

若如初见. 提交于 2021-01-28 12:42:53
问题 i wanted to map columns from one worksheet to another and this is the code i have tried: Dim x As Integer x = 2 Do Until Sheets("Sheet1").Range("A" & x).Value = "" Sheets("Sheet2").Range("C" & x).Value = Sheets("Sheet1").Range("A" & x).Value x = x + 1 Loop x = 2 Do Until Sheets("Sheet1").Range("B" & x).Value = "" Sheets("Sheet2").Range("A" & x).Value = Sheets("Sheet1").Range("B" & x).Value x = x + 1 Loop x = 2 Do Until Sheets("Sheet1").Range("C" & x).Value = "" Sheets("Sheet2").Range("B" & x)

Saving multiple dataframes to multiple excel sheets multiple times?

好久不见. 提交于 2021-01-28 12:40:07
问题 I have a function to save multiple dataframes as multiple tables to single excel workbook sheet: def multiple_dfs(df_list, sheets, file_name, spaces): writer = pd.ExcelWriter(file_name,engine='xlsxwriter') row = 0 for dataframe in df_list: dataframe.to_excel(writer,sheet_name=sheets,startrow=row , startcol=0) row = row + len(dataframe.index) + spaces + 1 writer.save() If I call this function multiple times to write multiple tables to multiple sheets, I end up with just one workbook and one

delete part of a row in pandas / shift up part of a row ? Align Column Headings

孤人 提交于 2021-01-28 12:36:29
问题 So I have a data frame where the headings I want do not currently line up: In [1]: df = pd.read_excel('example.xlsx') print (df.head(10)) Out [1]: Portfolio Asset Country Quantity Unique Identifier Number of fund B24 B65 B35 B44 456 2 General Type A UNITED KINGDOM 1 123 3 General Type B US 2 789 2 General Type C UNITED KINGDOM 4 4852 4 General Type C UNITED KINGDOM 4 654 1 General Type A FRANCE 3 987 5 General Type B UNITED KINGDOM 2 321 1 General Type B GERMANY 1 951 3 General Type A UNITED

Saving multiple dataframes to multiple excel sheets multiple times?

时光毁灭记忆、已成空白 提交于 2021-01-28 12:30:24
问题 I have a function to save multiple dataframes as multiple tables to single excel workbook sheet: def multiple_dfs(df_list, sheets, file_name, spaces): writer = pd.ExcelWriter(file_name,engine='xlsxwriter') row = 0 for dataframe in df_list: dataframe.to_excel(writer,sheet_name=sheets,startrow=row , startcol=0) row = row + len(dataframe.index) + spaces + 1 writer.save() If I call this function multiple times to write multiple tables to multiple sheets, I end up with just one workbook and one