excel-vba

Function Similar to importxml in Excel?

守給你的承諾、 提交于 2020-01-09 19:33:07
问题 I love using Google Docs function =importxml() but would love to know if there was anything like it in Excel 2010? I cant seem to find a way for the program to automatically pull data from a linked XML file. For example, I would love to be able to set up a column with the header "Item Name", then have the next column append the user-entered item name in the previous column to this url http://util.eveuniversity.org/xml/itemLookup.php?name= and then parse the resulting XML file to return the

How to loop rows with Excel VBA macro?

自闭症网瘾萝莉.ら 提交于 2020-01-09 19:09:03
问题 I am new to VBA, but pretty good with PHP. That being said, I'm struggling with VBA loops... I have this sheet with 40 rows called "SH1": SH1 A B C D E 1 2 One 1.0a 12 2 7 Two 2.0b 34 3 13 Three 3.0c 56 4 14 Four 4.0d 78 .. 40 I need to loop through 40 rows and check the value in column A. If the value in column A meets my criteria (see below), generate some output and put it in another sheet. My output sheet is 3-columns and called "SH2": SH2 A B C D E 1 1.0a 12 One 2.0b 34 Two 2 3.0c 56

How to loop rows with Excel VBA macro?

独自空忆成欢 提交于 2020-01-09 19:07:14
问题 I am new to VBA, but pretty good with PHP. That being said, I'm struggling with VBA loops... I have this sheet with 40 rows called "SH1": SH1 A B C D E 1 2 One 1.0a 12 2 7 Two 2.0b 34 3 13 Three 3.0c 56 4 14 Four 4.0d 78 .. 40 I need to loop through 40 rows and check the value in column A. If the value in column A meets my criteria (see below), generate some output and put it in another sheet. My output sheet is 3-columns and called "SH2": SH2 A B C D E 1 1.0a 12 One 2.0b 34 Two 2 3.0c 56

.NumberFormat sometimes returns the wrong value with dates and times

≯℡__Kan透↙ 提交于 2020-01-09 11:46:07
问题 It seems that every week or so someone posts a question about dates being converted (corrupted?) to American format. Like many others, I have attempted to help but the problem is elusive. I now wonder if I have discovered the cause. I am working on an application in which I need to extract data from an Excel worksheet and output it as strings formatted to match the value the Excel user can see. So if the value is “1” formatted to display as “1.00” then I want the string to be “1.00”. I

Excel VBA - Run macro before save

送分小仙女□ 提交于 2020-01-09 11:35:22
问题 I've been looking around on how to call my macro just before I save my document. I found this, but when I put my code inside it, it doesn't do anything. So I presume I'm missing something. Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Set shtVO = Sheets("Voice orders") endRowVO = shtVO.Range("E" & Rows.Count).End(xlUp).Row For Row = 11 To endRowVO If IsEmpty(shtVO.Cells(Row, 23).Value) = False Then If shtVO.Cells(Row, 3).Value <> shtVO.Cells(Row, 23) Then If

Get position (in number) of selected item in dropdown list

南笙酒味 提交于 2020-01-09 11:17:09
问题 In a dropdown list I have a few items. Can I, when I select an item, get the position of that item in the list as a number? 回答1: If you are using a list or combo box, ListIndex would seem to be what you are after. VB Help for ListIndex property: Returns or sets the index number of the currently selected item in a list box or combo box. Read/write Long. Remarks. You cannot use this property with multiselect list boxes. If nothing is selected, ListIndex 's value is -1 . If memory serves, it is

Sorting Groups of Rows Excel VBA Macro

我的梦境 提交于 2020-01-09 10:49:08
问题 I am having trouble figuring out how to create a sorting algorithm in VBA that sorts and swaps groups of rows (several rows at a time). I wrote a successful sorting algorithm using an array below: Function SortArray(ByRef arrToSort As Variant) Dim aLoop As Long, aLoop2 As Long Dim str1 As String Dim str2 As String For aLoop = 1 To UBound(arrToSort) For aLoop2 = aLoop To UBound(arrToSort) If UCase(arrToSort(aLoop2)) < UCase(arrToSort(aLoop)) Then str1 = arrToSort(aLoop) str2 = arrToSort(aLoop2

VBA (Excel): Iterating through files in folder via FileSystemObject

帅比萌擦擦* 提交于 2020-01-09 10:33:27
问题 Ok, so I consider myself an Excel VBA expert (even though I've not done much with it for a while) but I'm stumped on this one - that obviously means it is something extremely simple which I've overlooked due to my arrogance :D I'm using a FileSystemObject assigned to a global variable (called "myFSO" - original, I know...) and using two other global variables - xFolder and xFile - to iterate through all the files within a folder, and perform actions on each file within the folder. This is the

COM: excelApplication.Application.Quit() preserves the process

岁酱吖の 提交于 2020-01-09 10:28:49
问题 I'm using COM integration to drive MS Excel from Python 2.7. I noticed a peculiar thing: when I run the following bit of code: import win32com.client excelApp = win32com.client.dynamic.Dispatch('Excel.Application') an EXCEL.EXE process appears on the processes list (which view using the Windows Task Manager or subprocess.Popen('tasklist') ) as expected. I then do all the stuff I need to do no problem. However, when I close Excel: excelApp.Application.Quit() The process persists, even if I

Set formula to a range of cells

萝らか妹 提交于 2020-01-09 09:24:06
问题 this is simple demo of what i want to do. I want to set a formula to a range of cells(eg. C1 to C10). Range("C1").Formula = "=A1+B1" but how to make formula use dynamic cells like this: Range("C1:C10").Formula = "=Ax+Bx" so in reality it is like, C1 = A1 + B1 C2 = A2 + B2 C3 = A3 + B3 C4 = A4 + B4 C5 = A5 + B5 ... C10 = A10 + B10 how to change RHS of this formula to make above working: Range("C1:C10").Formula = "=Ax+Bx" 回答1: I would update the formula in C1. Then copy the formula from C1 and