excel-vba

List sheet names in a sheet, hyperlink them, and update list whenever sheets are added/deleted

好久不见. 提交于 2020-01-16 18:05:00
问题 I have found several codes that lists all the sheet names in a sheet and hyperlink them. I want to list all the sheets in the sheet "ListSheet" and make them hyperlinks. Two issues with the following code: 1) It should delete the previous list and insert the new one, in case I add or delete sheets (sub add_list() or sub delete_list()), but when I delete sheets the list keeps the old sheet names (so the list is probably not deleted before the new is created). 2) The list always created in the

recursive tree parsing with vba

ε祈祈猫儿з 提交于 2020-01-16 16:56:23
问题 Given the following spreadsheet of data: https://ethercalc.org/q7n9zwbzym5y I have the following code that will parse this and will derive a tree from the parent-child relationships in the sheet. Note that fact that every column occurs twice is because the first instance of the columns is for another type of data, I am only concerned with the populated columns. This is the desired output from the sheet above: Code: Sub performanceSheet(someParams) ' Write to "Performance" sheet Dim w1 As

VBA for data validation

放肆的年华 提交于 2020-01-16 16:48:04
问题 Recently, I found a code on a book for data validation, which is: Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = “$A$1” Then If Not IsNumeric(Target) Then MsgBox “Enter a number in cell A1.” Range(“A1”).ClearContents Range(“A1”).Activate End If End If End Sub I would like to change it to validate my custom format in column A which is XY & 6 number (XY123456) and modified the code. But the MsgBox will pop up continuously and I cannot close it when the format is wrong.

Modifying the program for parsing

不羁岁月 提交于 2020-01-16 16:06:47
问题 There is a program that parse a certain table from the site . Works great . I want to parse another table from the site . By the tag number “table” they are the same . I am trying to use the same program , but it gives an error : Run-time error 91 in the line : If oRow.Cells(y).Children.Length > 0 Then New table : http://allscores.ru/soccer/fstats.php?champ=2604&team=439&team2=420&tour=110 Old table : http://allscores.ru/soccer/new_ftour.php?champ=2604&f_team=439 New table : in the attached

Assigning variable workbook name with Inputbox VBA

戏子无情 提交于 2020-01-16 12:36:11
问题 I am looking to assign an input box string to a workbook name in order to manipulate data from one sheet to the next. For example, when I generate a report it is assigned a temporary file name "tmp1" "tmp2" etc. I would like to use another excel sheet as a program which will run a macro in order to sort, copy, etc. the newly generated file, with only having to enter the name of the temporary file "tmp1" etc. I am able to run the macro that I need and am familiar with the 'With' statements

VBA code to suppress the the control.Click() Sub / event handler

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-16 11:58:07
问题 OK. This is driving me nuts. I'm still getting a perpetual loop. My previous question got me so far >>> Using VBA code to modify OptionButton.value is activating the control.Click() Sub I've rewritten some example code to try and nut this out. I've set up a Boolean 'handler' as per other suggestions (eg: Suppress events in UserForms). (I've called it SwitchOnEventResponder ) When it gets to the code that is causing the click event to fire, the handler flips back to True (which allows a value

Add a calculated field in a Pivot table with a reference to a cell of the Pivot Table

∥☆過路亽.° 提交于 2020-01-16 11:57:28
问题 I have been trying to add a calculated field in the pivot table. The entire pivot table is created perfectly so far. The last column that I want to add id the calculated one. Unfortunately, so far I cannot even do it manually. However, if I just insert as a formula right next to the pivot table the below provided formula, then it works perfectly. =GETPIVOTDATA('Monthly $/SU Forecast',$A$15,'T-Lane','Athens to GREECE')-GETPIVOTDATA('Monthly $/SU Actual',$A$15,'T-Lane','Athens to GREECE') When

Add a calculated field in a Pivot table with a reference to a cell of the Pivot Table

白昼怎懂夜的黑 提交于 2020-01-16 11:57:11
问题 I have been trying to add a calculated field in the pivot table. The entire pivot table is created perfectly so far. The last column that I want to add id the calculated one. Unfortunately, so far I cannot even do it manually. However, if I just insert as a formula right next to the pivot table the below provided formula, then it works perfectly. =GETPIVOTDATA('Monthly $/SU Forecast',$A$15,'T-Lane','Athens to GREECE')-GETPIVOTDATA('Monthly $/SU Actual',$A$15,'T-Lane','Athens to GREECE') When

Is it possible to name a range on a sheet that does not exist yet?

蹲街弑〆低调 提交于 2020-01-16 11:54:09
问题 I am trying to create a named range for a worksheet that does not yet exist in the workbook. I will be using a macro to import a user-defined text file as the source. Am I restricted to only defining these named ranges once the worksheet has been imported, or can I name a future range on a sheet that does not exist yet? 回答1: In Refers to: =INDIRECT("NotYetASheet!$A$1") 回答2: I'm assuming the names will be created upon import of the data. I'm also assuming it's ok if your unnamed ranges return

Is it possible to name a range on a sheet that does not exist yet?

依然范特西╮ 提交于 2020-01-16 11:51:52
问题 I am trying to create a named range for a worksheet that does not yet exist in the workbook. I will be using a macro to import a user-defined text file as the source. Am I restricted to only defining these named ranges once the worksheet has been imported, or can I name a future range on a sheet that does not exist yet? 回答1: In Refers to: =INDIRECT("NotYetASheet!$A$1") 回答2: I'm assuming the names will be created upon import of the data. I'm also assuming it's ok if your unnamed ranges return