vba

Excel VBA Conditional Formatting not executing

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-07 09:16:07
问题 This is odd. I'm creating an Excel 2003 spreadsheet from MS Access 2003 VBA, and the coding includes conditional formatting: if the cell value is greater than [a value] it's colored red if it's less than [a value], it's colored green. Even though the CF formulas are created successfully when the spreadsheet is generated, all the colors are green, regardless of the value. If I manually type the original value into a cell, it will trigger then CF and it appears correctly, but otherwise it just

Excel VBA Conditional Formatting not executing

走远了吗. 提交于 2021-02-07 09:14:29
问题 This is odd. I'm creating an Excel 2003 spreadsheet from MS Access 2003 VBA, and the coding includes conditional formatting: if the cell value is greater than [a value] it's colored red if it's less than [a value], it's colored green. Even though the CF formulas are created successfully when the spreadsheet is generated, all the colors are green, regardless of the value. If I manually type the original value into a cell, it will trigger then CF and it appears correctly, but otherwise it just

Access .NET generic objects from VBA

穿精又带淫゛_ 提交于 2021-02-07 09:14:09
问题 My .net code has an object with a number of generic properties. This object is returned to the VBA code. All the non-generic properties are working well, but I also need to access the generic values. Is there a way to do it from VBA? [ClassInterface(ClassInterfaceType.AutoDual)] public class Obj { public string GetProp1() {...} public IList<MyCustomType> GetProp2() {...} } VB code: Sub Test() Dim o As Program.Obj Set o = New Program.Obj Set p2 = hp.GetProp2() set p2_0 = p2(0) ' doesn't work

How to import a csv file using @ as delimiter with VBA

旧巷老猫 提交于 2021-02-07 07:15:50
问题 I am trying to load data from a csv file in Excel with VBA using ADODB. I have a function to return a Connection object. Private Function OpenConnection(dataSource As String) As ADODB.Connection Set OpenConnection = CreateObject("ADODB.Connection") With OpenConnection .ConnectionTimeout = 5 .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dataSource & ";" & _ "Extended Properties=""Text;HDR=YES;FMT=Delimited(,)"";Persist Security Info=False" Debug.Print "trying to connect

How can I investigate and resolve an (apparent) Access database corruption?

允我心安 提交于 2021-02-07 06:06:24
问题 I have an Microsoft Access 2010 database application with split front end and backend which has started to behave oddly, and I've exhausted all the options I know for investigating and resolving the problem. 32-bit Access 2010 running on Windows 8.1... I have both Access 2010 and Access 2013 installed, but the problem also manifests itself on a Windows 8.1 system with a completely fresh install of Access 2010 and no Office 2013 present. The issue also exists if the application is run using

excel vba getting the row,cell value from selection.address

天大地大妈咪最大 提交于 2021-02-07 05:13:13
问题 For i = 1 To 20 '' select the cell in question Cells.Find(...).Select '' get the cell address CellAddr = Selection.Address(False, False, xlR1C1) Next The above is my code for searching a spread sheet to find a specific string and then select it. I'd like to get the address of the cell using Selection.Address which, in this case, returns something along the lines of R[100]C . Is there a way I can split that result in to row and column values so I can manipulate them in code? I'd like, for

Create List of unique elements and display group membership parsed by commas and en-dash

落花浮王杯 提交于 2021-02-07 04:36:11
问题 I'm an Excel VBA newbie and I'm trying to figure out how to create a unique list of names in one column with associated group names in the next column. For example, the Name "cds" is a member of the following groups: "group1","group3","group4","group5", and "group6". I would like the output to show: |Column D | Column E | cds group1, group3–group6 I did find a Macro on a different message board that displays the unique element with the associated Group Number(s) instead of Group Name(s) .

Find the first empty row after the given row number in Excel VBA

安稳与你 提交于 2021-02-07 04:35:15
问题 I need to find the first empty row number after the given row number. please check the image below for e.g: assume, my current row number is 6 then my output should be 10. 回答1: I use CountA to see if the entire row is empty. Function FirstEmtpyRow(startRow As Long) As Long Do startRow = startRow + 1 If startRow = rpws.Count Then Exit Function Loop Until WorksheetFunction.CountA(Rows(startRow)) = 0 FirstEmtpyRow = startRow End Function 回答2: Something like this? function FindFirstEmpty(i as

Automatically run macro daily without opening any workbooks

随声附和 提交于 2021-02-07 04:19:32
问题 I am still relatively new to VBA and not too experienced with the Application.OnTime method. I have been looking at multiple resources, and I cannot see a clear way to automatically run a macro daily without opening any workbooks (assuming I run the macro first in my workbook). Is this possible? I would like to be more efficient instead of running multiple macros every morning. Let me know if you need more info but my code would simply be a copy/paste process: Sub MyMacro() Application

Automatically run macro daily without opening any workbooks

爷,独闯天下 提交于 2021-02-07 04:17:10
问题 I am still relatively new to VBA and not too experienced with the Application.OnTime method. I have been looking at multiple resources, and I cannot see a clear way to automatically run a macro daily without opening any workbooks (assuming I run the macro first in my workbook). Is this possible? I would like to be more efficient instead of running multiple macros every morning. Let me know if you need more info but my code would simply be a copy/paste process: Sub MyMacro() Application