excel-vba

Save excel Workbook in a new created folder with the Same names

妖精的绣舞 提交于 2020-01-06 02:48:05
问题 I found this code and it should create a new folder and should save the file in it. Problem here the code doesn't work... The code I found should create a folder in the code written path but i want that it creates the folder and the new sheets in the same path as the workbook now is. i don't know how I can bin this in "thisWb.Path" Original code i found Sub Macro1() Dim strFilename, strDirname, strPathname, strDefpath As String On Error Resume Next ' If directory exist goto next line

VBA Close Java Alerts Popups with name “Message from webpage”

◇◆丶佛笑我妖孽 提交于 2020-01-06 02:27:07
问题 Im having a problem dealing with the java scripts alerts.. I am able to navigate and enter data in the webpage but when selecting different item to update a modal alerts displayed.. How can I click the OK button tru VBA? Any help please... Here is the code in the webpage i think firing when i select an item triggering the alert.. This is what i see in the HTML scripts: function onUpdatedShowAlertTS(varControl) { if (varControl == "ddlProjectStatus") { var varconfirm = document.getElementById(

VBA Close Java Alerts Popups with name “Message from webpage”

泄露秘密 提交于 2020-01-06 02:26:25
问题 Im having a problem dealing with the java scripts alerts.. I am able to navigate and enter data in the webpage but when selecting different item to update a modal alerts displayed.. How can I click the OK button tru VBA? Any help please... Here is the code in the webpage i think firing when i select an item triggering the alert.. This is what i see in the HTML scripts: function onUpdatedShowAlertTS(varControl) { if (varControl == "ddlProjectStatus") { var varconfirm = document.getElementById(

Randomize word in VBA

拈花ヽ惹草 提交于 2020-01-06 02:00:06
问题 I need to write a vba code that would give me all the letter combinations of a word and save it into a text file (this code is optional). For, instance, the word 'aBc' would return: aBc acB Bac Bca caB cBa I'm sure it's an easy code but I can't seem to figure it out. Here's the code I have so far. It keeps giving me duplicates and not all the results. Sub Scramble() Dim Rand1() a = Len(Range("a2").Value) ReDim Rand1(a) T = 0 Randomize For n = 1 To a Check1: Rand1(n) = Int((a * Rnd(100)) + 1)

Hide rows based on Drop Down list in Excel

末鹿安然 提交于 2020-01-06 01:56:06
问题 This is basically a mail template, containing 3 different types of content. I have an excel sheet with a combo-box list. The list has values 1,2 and 3. & 3 different types of content for them. When any one of them is selected . The remaining content must be hidden. 回答1: Assuming you have validation option set in Range("A1") with different options (1-3 in my example). In the appropriate Sheet module put the following code and change it as needed. Private Sub Worksheet_Change(ByVal Target As

How do I clean up objects in Excel vba?

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-06 01:17:16
问题 Public Sub D_Galoplar() Application.ScreenUpdating = False Dim Asay(1 To 250) Dim Jsay(1 To 100) For q = 2 To Sheets("Y").Columns("A:A").Find(What:="boş").Row - 1 Asay(q - 1) = Sheets("Y").Range("A" & q) Next q For q = 2 To Sheets("Y").Columns("C:C").Find(What:="boş").Row - 1 Jsay(q - 1) = Sheets("Y").Range("C" & q) Next q For w = 1 To 250 Cells.Delete Shift:=xlUp Range("A1").Select If Asay(w) < 1 Then Exit For Dim elem As Object, trow As Object Dim R&, C&, s$ With New XMLHTTP60 .Open "POST",

VBA Sort Macro not working

倾然丶 夕夏残阳落幕 提交于 2020-01-06 01:16:28
问题 The sort code is not working anymore. It worked the first time. Then I closed it and opened it and then it gave me an error. (I didn't change anything.) It gave me: Error 438: Object doesn't support this property or method On this line: DataWB.DataSheet.Sort.SortFields.Add Key:=Range(FNOrdCol), SortOn:=xlSortOnValues, _ Order:=xlAscending, DataOption:=xlSortNormal` Snippet of sort code: 'Alpahebtical order DataSheet.Range("A1").Select ActiveCell.Rows("1:1").EntireRow.Select Selection.Find

How to make userform in Excel VBA remember password when 'red x' is pressed

喜欢而已 提交于 2020-01-05 23:30:53
问题 I have a userform that calls a function with username/password prompt. The user usually has to run it more times and each time is prompted for the login credentials so I want the userform to remember the user/password once it has been given until the workbook has been closed. It is working fine until the user presses the 'process' button or closes the userform from the 'close' button, but when he/she closes it with the 'red x', the user/pass disappears on the next run. I know that the 'red x'

Unexpected behavior when refreshing internal data connections in Excel

心已入冬 提交于 2020-01-05 23:29:05
问题 I have faced a big and inconvenient problem with Excel spreadsheets that have internal data connections (queries that selects ranges of the own workbook) in them. I wiil start by showing the problem e exposing how to reproduce it. Problem: if I have some internal connetion and another instance (pay attention, instance, not other workbook) was already open, when refreshing that connection, the same workbook (which have the internal connection) is instantly opened in readonly mode in another

Select alternate points and move labels above/below

我的未来我决定 提交于 2020-01-05 22:50:12
问题 I am fairly new to VBA and trying to select alternating points to place datalabels above and below. Here is my code that is currently placing a datalabel below point 1 which I want, but then I want the 3rd point's label to be placed below as well, and the other ones above. I have tried many different loops and codes but nothing seems to work and I'm not sure why it seems to copy and paste instead of move the label. For x = 1 To ActiveChart.SeriesCollection(1).Points.Count With ActiveChart