excel

Optimizing the VBA Code and improve the performance

不问归期 提交于 2021-02-13 11:24:25
问题 I have developed a VBA macro which is used to refresh the 5 SAP AAO Queries and then copy those queries data into tables saperately by removing duplicates and then loaded into the power query. There i add some calculated columns and then load that data into the power pivots. I have also used the VBA code mentioned below to perform some actions in each of the sheets, however it is currently taking more than 4 minutes to run the code. In that 4 minutes at least 45 seconds are going for

VBA paste as values - how to

我与影子孤独终老i 提交于 2021-02-12 11:39:55
问题 I have some VBA code that copys a range from one sheet and then pastes it to another at the first blank line. What it is copying are vlookup formulas so when it pastes it pastes all 0's, how would I go about getting it to paste what it copies as values so the results are retained? Code: Private Sub PasteChartDataQtyCompare() 'This step pastes the range of values to the chart data tab Sheets(1).Range("A6:J22").Copy _ Destination:=Sheets("Chart Data").Cells(Sheets("Chart Data").Rows.Count, 1)

Excel Count unique value multiple columns

末鹿安然 提交于 2021-02-11 18:24:55
问题 I have a workbook with multiple sheets. On sheet1 I would like to count the number of times person in column A has a particular entry in Column C that meets criteria of column D = Content but only count if column B is a unique value. Using the below formula I can do everything except only counting unique numbers in Column B. I enter this formula in Sheet2 C2 then pull across to I2 then pull down to 6 in each column. =IF(COUNTIFS(Sheet1!$A$2:$A$150,Sheet2!$B2,Sheet1!$C$2:$C$150,Sheet2!C$1

VBA: Chart_Data points not visible in graph

喜你入骨 提交于 2021-02-11 18:24:39
问题 I dont get the line curve for the data given below however I see the data being plotted but not visible as a smooth line. Please help. Column B Column C x y 0.00 0.00 -0.10 0.29 -0.35 0.48 -0.65 0.48 -0.90 0.29 -1.00 0.00 Set ch = ActiveSheet.ChartObjects("Chart 1") ActiveChart.ChartType = xlXYScatterSmoothNoMarkers ch.Activate p=1 For i = 1 To 6 ser_count = ActiveChart.SeriesCollection.Count p = ser_count + 1 ActiveChart.SeriesCollection.NewSeries ActiveChart.SeriesCollection(p).XValues =

Excel Count unique value multiple columns

心已入冬 提交于 2021-02-11 18:24:36
问题 I have a workbook with multiple sheets. On sheet1 I would like to count the number of times person in column A has a particular entry in Column C that meets criteria of column D = Content but only count if column B is a unique value. Using the below formula I can do everything except only counting unique numbers in Column B. I enter this formula in Sheet2 C2 then pull across to I2 then pull down to 6 in each column. =IF(COUNTIFS(Sheet1!$A$2:$A$150,Sheet2!$B2,Sheet1!$C$2:$C$150,Sheet2!C$1

VBA set a Loop for specific worksheets in a workbook

ε祈祈猫儿з 提交于 2021-02-11 18:21:33
问题 I run a monthly report that generates 16 tabs (15 worksheets: "Report1" - "Report15"). I've created a sub to create/format a table, and organize the data on Sheet2("Report1"). Objective: Because of the Table Style, I would now like to loop the macro through "Report1", "Report4", "Report7", "Report10", "Report13" Only. (Once I figure this out, I'll create a Macro with another Table Style for the other worksheets.) Issues: Through 'Googling' I created the below Loop, but the "Set ws =

VBA set a Loop for specific worksheets in a workbook

情到浓时终转凉″ 提交于 2021-02-11 18:21:28
问题 I run a monthly report that generates 16 tabs (15 worksheets: "Report1" - "Report15"). I've created a sub to create/format a table, and organize the data on Sheet2("Report1"). Objective: Because of the Table Style, I would now like to loop the macro through "Report1", "Report4", "Report7", "Report10", "Report13" Only. (Once I figure this out, I'll create a Macro with another Table Style for the other worksheets.) Issues: Through 'Googling' I created the below Loop, but the "Set ws =

VBA Word Expand Range with one line

随声附和 提交于 2021-02-11 18:21:11
问题 First of all this is the first time I am creating a macro using VBA code. With some bits and pieces i found on the internet I tried to create the following. I am not a developer at all, I just have some basic knowledge from school. So my apologies if this is poor coding. I am creating a macro in word which highlights text from a paragraph heading until the next heading with the same style. This is done based on a list of headings I import from Excel. You can find the code I have created below

How to change encoding from UTF-8 to UTF-8-BOM of exported *.txt files from Excel?

落花浮王杯 提交于 2021-02-11 18:19:39
问题 Exported text files from Excel are encoded with UTF-8. An encoding UTF-8-BOM is needed. I think that in code shall be inserted a row, written like: Java ?xml version="1.0" encoding="UTF-8"? Jasperreport CSV UTF-8 without BOM instead of UTF-8 or HTML5 meta charset="utf-8" Bad UTF-8 without BOM encoding Sub export_data() Dim row, column, i, j As Integer Dim fullPath, myFile As String fullPath = "C:\Workspace" row = 21 column = 5 For i = 1 To column myFile = Cells(1, i).Value + ".txt" myFile =

64 bit Excel VBA to call a JavaScript function

Deadly 提交于 2021-02-11 18:16:43
问题 I need to use a VBA ScriptControl object to call a JavaScript function , but it gave me a "Class Not Registered" error. I have added Microsoft Script Control 1.0 from Tools->References I need to call JavaScript to get a JSON object from this Rest API to calculate values in an Excel Macro. This post told me that ScriptControl is for use in 32 bit only. I am using 64 bit Excel. I also tried using the method mentioned in this link but it didn't work since VBA doesn't recognise the ActiveXObject