excel-vba

Excel VBA - Parse Server Logs

heya, We have a small project that involves automatically parsing some server/mail logs (among other things). Now, Plan A was to just hack together some Python and Django to do this properly grins, but I got veto-ed and the solution has to be pure-Excel, as it's believed that will be more portable. 1. Importing tab-separated file Our ...

VBA Excel Range method

I need to move a row of data to another worksheet when a user chooses a value in a listbox. I am trying to use the following code to select the row on the new worksheet I want to move the data to: 'Move data to the "Red" worksheet Sheets("Red").Range ("A11").Select I am getting an "Object does not support this property or method" err...

How to delete all constraints from solver in Excel?

I can use SolverDelete to delete a constraint if I know exactly what it looks like. How can I delete all constraints with VBA without knowing them? ...

How to link VBA app against debug mode COM DLL

I am trying to debug an VBA excel app that invokes some functions from a C++ COM DLL. I have added type library of the COM DDL in Tools--->References. If i build the DLL in debug mode, VBA app complains about not finding the dll at run-time. When i build the DLL in release mode, i am unable to debug it. Does anyone knows how to link VBA...

Use Excel VBA to fill out and submit Google Docs form

I'm trying to do something like this post but with Excel VBA. I would like to submit a response on a google docs form each time a button is pressed on an Excel add-in. The addin will be an XLA file and written in VBA. I want to be able to collect what features the users are using. If someone has a better solution, I'm open. ---Edit---...

Excel VBA: how to cast a generic control object into a ComboBox object?

Hi, I need to cast a generic VBA form control object into a ComboBox object so that I can add items to it. The generic object won't allow me to insert items into my existing lists Dim ctlCurrent As MSForms.Control For Each ctlCurrent In frmItemInput.Controls If TypeName(ctlCurrent) = "ComboBox" Then Dim lbCurrentComboBox As...

In Excel, VBA - How can we lock resizing of a rectangle

I have an excel sheet that contains two rectangles and text in other cells. I need to allow users to only edit the text in the rectangle. They should not be able to change the size of the object. Applying lock on the rectangle locks the object as well as the text. Does anyone know how I can achieve this? ...

Excel VBA Macro - Exclude some columns while Copying one row to other

Hi, I want to copy contents of one row in excel to other row. Currently I am using following code for copying data from previous row. rngCurrent.Offset(-1).Copy rngCurrent.PasteSpecial (xlPasteValues) But I want to skip some columns. So lets say if there are 20 columns, I want to copy all columns except column 4 and 14. How to acheiv...

How do i copy rows from one worksheet and then delete them after it has moved?

hi, How do i copy rows from one worksheet programatically using VBA and then delete them after it has moved? I don't seem to be deleting all records based on the criteria, i'm searching for. Dim lRowCounter as Long, lTotalRows as Long,sCommPerUnit as String,lExceptionRowCounter as Long lTotalRows = 10 For lRowCounter = 1 To lTotalR...

Redimming arrays in VBA

I have 3 arrays of data, that are filled by reading off of an excel sheet, some of the points of data are missing and as such have just been entered into excel as "NA" so I want to look through my array and find each instance of these NA's and remove them from the array since the information is useless. I need to update all three arrays ...

Can't read the value of a button click from a userform

I hope this is a relatively easy problem although I have spent hours websearching and using T&E to no avail. Hopefully someone can help ;o) I have an excel module that shows a UserForm to get some input data before doing a lot of processing. At the bottom of the userform are a couple of command buttons labeled "OK" and Cancel". I nee...

How to save Excel date time cell into MySQL using VBA?

The mysql table has a DATETIME field. I want to INSERT a new row into this field using the cell data from the Excel worksheet. But I cannot use the datetime formatted cell value in a INSERT INTO query. How can I implement this? ...

Run VBA macro when condition is met

Hello all, I'm creating a spreadsheet to train my numerical skills. Now, I use VBA macros to generate a new problem once the current one has been correctly solved. To do so, I still have to press a button in the worksheet, which costs time and is annoying. Is there a way that I can execute a macro when a certain condition is met? f...

Changing array values in a VBA dictionary

Hi I have a piece of code that does not seem to do what it is expected to do. VBA Arrays are mutable by all means, but it seems that when they are stored into a Dictionary as values of some keys, they are not mutable anymore. Any ideas? Sub foo() Dim mydict As New Dictionary mydict.Add "A", Array(1, 2, 3) MsgBox mydict("A"...

Time based VBA script for exercises

I have an excel spreadsheet with two columns, one with a list of exercises (33 of them) and a number of reps for each. What I really want is a program that picks a random exercise, displays it with it's number of reps, and has a button that says something like "Done?" When you click it, I want a timer that counts down 20 minutes, picks a...

Calling oracle stored procedure from Excel - VBA

I have to execute an Oracle stored procedure from vba (Excel) with around 38 input parameters. The stored procedure will insert some values in the destination table once that is executed. When it is executed through VBA the number of fields which is inserted is less than when it is executed directly from the backen...

Updating target workbook - extracting data from source workbook

My question is as follows: I have given a workbook to multiple people. They have this workbook in a folder of their choice. The workbook name is the same for all people, but folder locations vary. Let's assume the common file name is MyData-1.xls. Now I have updated the workbook and want to give it to these people. However when they r...

VBA Range.Rows.Count giving unexpected results

I have a Range variable that contains an address - $2:$2,$4:$205,$214:$214 - (3 groups of rows). I would like to get the count of all the rows in that range. However, range.Count gives me the count of all the cells (50,000~) and range.Rows.Count only return 1 - the count of all the rows in the first group. How do I get the count...

I need help to automate my concatenate to change daily without having to manually input the new data entered each day.

Hi there I use concatenate to pull data together from different cells in my spreadsheet. Since my data changes daily, I want the formula to also change daily without having to manually input the new cell in the concatenate formula. I am looking for a way to do this but not sure how. Can anyone out there help me out please!? I appreciate...

Simple variable assignment in Excel 2003 VBA

Hi, I am new to VBA in Excel. I'm setting up a simple macro Option Explicit Sub Macro1() Dim sheet sheet = Worksheets.Item(1) ' This line has the error End Sub On the line with the error, I get "Run-time error '438' Object doesn't support this property or method" I can use the Watch window to see that "Worksheets.Item(1)" i...