excel-vba

Problem using SUM(If( Rather than SumIf(

I have written a Formula in Excel that Sums up Items in 1 Column (Text) the Column is a Dynamic Named Range (Invoice_list_Item) the Formula sets a Value (Of my Choice) based on each Item in the Range and Sums those Values, I am now using a Userform where I would like to Display that Equation rather than in the workbook itself, so my prob...

VBA ADODB excel - read data from Recordset

Hope you can help me, I would like to read data from excel file, and the way I was doing was creating instance of Excel application in backgroud, but than I am prompted about VBA macros - disable or enable it. I have 100 of excel files that I need collect data from, so if I would be prompted every single file, i would end up with reall...

Synchronize Data Access

Some years ago I built an Excel file for my colleagues that displays lots of data from an external ODBC data source. The data is partitioned into lots of data tables in different sheets. The file also contains a button that allows the user to update the data. Since accessing the data from the external source was very slow, I implemented...

VBA Events: load workbook before running code using workbook_open

Hi Everyone, I want to run a VBA macro AFTER the workbook has finished opening. I tried to use workbook_open but this runs before the workbook has finished opening. This doesn't work for me as I need to loop through each sheet like so... Private Sub Workbook_Open() Dim ws As Worksheet For Each ws In ActiveWorkbook.Worksheets 'do stu...

Transpose Rows in Columns in MS XLS using VBA

I have an XLS for which I need to A1:H1 to say A1:A7. I can achieve this by using the transpose function in copy. However I need to do this as part of VBA script. I don't seem to find any equivalent function. ...

VBA Search + Sum Problem "Complicated Algorithm" PLEASE HELP! (Tried Sum,CountIf,Dsum,SumProduct)

I have a hard equation I cant figure out, I'm hoping to make make up a Macro, any help appreciated. I have a Userform with a ComboBox "History_Select_Debtor" The RowSource for the ComboBox is "Debtor_list_Debtors" - A Dynamic Named Range on WorkSheet "DebtorList", It Consists of Customer Names from A2:A24 but will grow eventually. The ...

Copy table in Outlook body to the clipboard and paste in Excel VBA

I need to copy table in Outlook body to the clipboard and paste in Excel using VBA. I need to preserve the data in the cells, but I do not know how to do that. The data looks likes this, but when copied and pasted into excel it would be in four cells. -339 -339 5 5 Thanks ...

Http Post in Vba

I am trying to figure out how to make a POST in VBA. Ideally I'm looking for a simple working example that I can play with. This is what I have so far, but I'm not really sure what to do with it. Mostly what does the formdata look like. Function WinHTTPPostRequest(URL, formdata, Boundary) Dim http Set http = CreateObject("MSXML2.X...

Excel formula to check cell contents

Hi everyone, I'm trying to create some conditional formatting at runtime (huzzah) for an add-in (double huzzah), and have found that, apparently, some functions cannot be used as they would in a normal worksheet. (I just get an invalid procedure call error 5 when trying to create the CF referencing a VBA function I could call in a cell,...

Insert bold text into Word using VBA

I wrote a little script that exports certain Excel cell values into Word. However, certain inserts need to be bold. And there doesn't seem to be an easy way to do this. This code loops through the records and adds them to the Word document Do While intRow < intTotalRows + 1 strTemp = " ;b;" e; " If st...

Which Source Code Management System Suits My Needs Best? Git or SVN? How do you diff excel spreadsheets?

Hello again! I am currently looking at the efficiency and ease of our companies source code / resource management tools.. For the last couple of months i have been using Git to manage all of my web development code and images.. and for me it works fine. However some of my colleges aren't entirely comfortable using the command line. o...

Excel Macro - combine Multiple Columns Into One

Hello there! I have an excel 2007 worksheet with 12 columns (each column is corresponding to a month) and every column includes +/-30000 rows of daily rainfall data. What I need to do is combine these columns of data into one new column (one continuous rainfall series) as follows: Copy the first 31 (the number of days of January) rows...

How to stop VBA code running?

Hi, guys. Say I have a button embedded into my spreadsheet that launches some VBA function. Private Sub CommandButton1_Click() SomeVBASub End Sub Private Sub SomeVBASub DoStuff DoAnotherStuff AndFinallyDothis End Sub I'd like to have an opportunity to have some sort of a "cancel" button that would stop SomeVBASub ex...

Catch max time/iteration dialog box when using Excel Solver in VBA

I am using the built-in solver in Excel 2003 within a VBA loop to solver a number of different problems. Occasionally, the solver hits the maximum time or iterations limit, which causes a pop-up dialog box to appear asking whether the user wants to Continue, Stop, or End. In all cases I want it to end, and proceed to the next line of the...

How to return C# two dimensional array to VBScript

I am planning to develop a function in C# which will return a two dimensional array. This new C# function will be called through VB script. Also the length of the returned array will be dynamically changed so I am not sure how to return this array to vbscript. Any insight on approach/pseudo code will be of great help. Thanks. ...

vba collection of shapes

Hi, I want to store buttons in some sort of collection, arraylist, so that I can add and remove dynamically. I tried to use Collection but seems it is not the choice, as I got an error when ar.Add() is reached. Object doesn't support this property or method. Public Sub removeAllFormsWithAdd() Dim myshape As Shape Dim ar As Coll...

Copy filtered data to new Excel workbook and prompt with Save As dialog

I have a worksheet which contains some financial data to be transferred to accounting system. Can say I know some things about programming, but Excel macros are little too much for me, so please suggest some (even partial) solutions to my problem. Thanks! Master workbook columns are: Name Account Date Followup Amount Checked Transfer...

Excel VBA puts extra blank line at end of text file when exporting

I have an Excel VBA macro that outputs to a text file. There is always a blank row at the bottom of the text file and I am having trouble getting rid of it. Any useful suggestions would be greatly appreciated! Thanks Here is a sample text file generated from this code: link. You would probably have to download it and open it in notepad ...

Pulling dynamic data from Sheet2 into Sheet1 then to Sheet3..10

So I have Sheet1 and Sheet2, Sheet1 is user set settings and Sheet2 is a table of values generated by different values in Sheet1. Now Sheet3..10 can be created, which will pull a value from Sheet2 based on calculations on it. The problem I'm running in to is when say Sheet3!H20 is updated from Sheet2!I15, how do I get Sheet3!H20 to have...

Forcing the unloading forms from memory

I am writing a solution in Excel that uses a number of linked data entry forms. To move between he sequence of forms, the user can click a "Previous" or "Next button. The current form is unloaded and the new one loaded and opened. Sub NextForm(curForm As MSForms.UserForm, strFormName As String) Dim intCurPos As Integer ...