excel-vba

Excel VBA ADO UPDATE SQL Table/Record

泪湿孤枕 提交于 2020-01-17 04:13:53
问题 I have managed to update an SQL table and record by using this SQL string "UPDATE Breach_Test_Key SET [VAL_BREACH_REASON] = 'SOME BREACH REASON' WHERE [ID] = 1" Two things I am trying to achieve and that is: Update two specific columns in the SQL Table, how do I define two columns in the SET? I also need to update all records that are in a table in Excel back into an SQL table (which will all exist in the SQL table). The ID field will always match as the data is from this table. Please could

Excel : Alternatively Change Cell Color as Cell Value Changes

无人久伴 提交于 2020-01-17 03:58:06
问题 I have developed an Excel Real-Time Data Feed (RTD) to monitor Stock Prices as they arrive. I Would like to find a way to change the color of a cell as prices change. For example, a cell initially Green would turn to Red when the value changes (new price occurred on it via RTD Formula it contains) and then change back to Green when a new price arrives, and so on... 回答1: Maybe this can get you started? I supose a event is raised when the real time data is refreshed. the concept sis to store

Extracting Filename from Dir()

送分小仙女□ 提交于 2020-01-17 03:27:08
问题 I have a macro that uses the Dir function. MyFile = Dir(CurDir() & Sep & "*.xls") Do While MyFile <> "" ... MyFile = Dir() Loop How do I extract just the filename from MyFile (exclude the extension)? 回答1: It doesn't look like there is a convenient built-in function, so you'll have to do some string manipulation: ' Get just the file name and extension lastPathIndex = InStrRev(MyFile, Application.PathSeparator) If lastPathIndex >= 1 Then MyFile = Right(MyFile, Len(MyFile) - lastPathIndex) End

vba use linest to calculate polynomial coefficients and index to output

南笙酒味 提交于 2020-01-17 03:23:41
问题 I have two rows of data, fracture pressure and depth. I have to code in vba to generate the polynomial (quadratic for this case) equation and then output the coefficients to the worksheet. I am using Linest and Index. For this two rows of data, I don't know how many datasets I have because I need to delete some noisy data first (the definition of noisy data is randomly so the number of datasets vary each time), so I can't use something like "A17:A80" in the linest function. However, it looks

How to select a subset of a table with Excel VBA in the manner of SELECT -> FROM -> WHERE

北城余情 提交于 2020-01-17 03:23:09
问题 Apologies is this is the classic newbie question, but I haven't been able to find a concrete answer. I'm entirely new to Excel VBA and to programming in general. What I'm trying to do is select a subset of data from a large excel sheet that's roughly in this format: Name Data One Data Two Data N ---------------------------------------------------- Person One x x x Person One x x x Person One x x x Person Two x x x Person Two x x x Person Three x x x I will have a new sheet to deal withe every

RT 1004 - Method 'Range' of object '_Worksheet' failed

拈花ヽ惹草 提交于 2020-01-17 03:10:28
问题 I am getting a RT 1004 - Method 'Range' of object '_Worksheet' failed error on this line: LRWGM = MANs.Range("A" & Rows.Count).End(xlUp).Row from the code below. Not sure why. Any idea's? Below is the full code: Sub Copy_To_Template() ' ' The following is a list of the Source Workbooks and Worksheets Dim PRM1 As Workbook ' source workbook 1 contains current list of unassigned Problem Tasks Set PRM1 = Workbooks("BCRS-PTASKS Unassigned.csv") Dim PRM2 As Workbook ' source WorkBook 2 contains all

VBA, excel cut a part from a string

二次信任 提交于 2020-01-17 02:40:46
问题 I would like to get a part from a string. Im not familiar with VBA or unusual excel functions, but I think maybe a macro or a VBA code can help me. I need to cut down everything from the whole string from the cell, except what is after the Total. To clear this, I need the numbers which stand after the total. I dont know any functions in excel which can solve my problem. Is there something like trim or something which recognize the 'total' and give me the number after that? Example: From this

Excel VBA comparing two workbooks

痞子三分冷 提交于 2020-01-17 02:22:27
问题 I'm trying to create a macro which compares two Excel files. The only column both Excel files have in common is " eRequest ID ". The goal is to display any records that DO NOT have an " eRequest ID " in both files. For example, if record 1 is only found in one of the two files, it has to be displayed. The only situation where records are not displayed is if the " eRequest ID " is found in both files. On a side note.. I recorded a simple macro to filter out some fields... I have to add in this

Excel VBA comparing two workbooks

亡梦爱人 提交于 2020-01-17 02:20:32
问题 I'm trying to create a macro which compares two Excel files. The only column both Excel files have in common is " eRequest ID ". The goal is to display any records that DO NOT have an " eRequest ID " in both files. For example, if record 1 is only found in one of the two files, it has to be displayed. The only situation where records are not displayed is if the " eRequest ID " is found in both files. On a side note.. I recorded a simple macro to filter out some fields... I have to add in this

VBA Macro To Select Same Cell on all Worksheets

痞子三分冷 提交于 2020-01-17 01:47:20
问题 I'm somewhat newer to VBA, and this particular action seems like it may be out of my current scope of knowledge. Is there a way to code VBA to have it actively select the same cell on all worksheets as the current cell selected? I have a model I've put together to allow my team to enter data simultaneously regarding product SKUs in Column A on Sheet1, but due to the large amount of information that we enter per item, I used multiple sheets For example, if I have cell H4 selected on Sheet1, is