excel-vba

Moving images between cells in VBA

Hello guys, I have an image in cell (3,1) and would like to move the image into cell (1,1). I have this code: ActiveSheet.Cells(1, 1).Value = ActiveSheet.Cells(3, 1).Value ActiveSheet.Cells(3, 1).Value = "" However, it seems that the cell value is empty for cells containing images, so therefore the image is not moved and the image ...

object array or collection in VBA Excel

i would like to have an array of objects in excel that call one event handler. specifically I have multiple buttons which perform the same function to different cells, and to keep from duplicating code I would like to simply reference these button objects via an index (like I used to do in VB 6.0).... by finding which button was clicke...

How to use the Worksheet_Change event for Conditional Formatting?

I have a worksheet which contains a list of tasks, one on each row. Column A is the task name, column B is the date when it must be done and Column C is the person who must do it. Column D is used to indicate when it's been done. If this column contains anything, then the background colour for whole row should be grey, otherwise it shoul...

Excel VBA Recalculate Selection

I've got some Excel spreadsheets that are hitting the database pretty hard (100+ queries against the general ledger table... yikes!). Refreshing just the sheet I'm on (SHIFT+F9) is helpful in some spreadsheets, but I wanted a way to refresh just the selected cells. I'm came up with the following code, placed in the ThisWorkbook object: ...

Excel: Putting together two different complex formulas (Unique distinct list & Split)

Hello all you amazing people I wanted to do two things populate a unique distinct list from a long list of repetitive values extract component of a text delimited with hyphen I found solutions to each one of these problems at different places. Unique distinct list here: http://www.get-digital-help.com/2009/03/30/how-to-extract-a-un...

Excel's cell center shifted

Hi community, I have been working on a math drill program for a bit now. I had asked a similar question to this previously but I wasn't getting any good help with it. So I decided to research the problem more thoroughly and found something interesting. Now before I begin, I just want to go over the preliminaries. Yes, I am using Micros...

excel vba adding programatically commandbutton to userform

hi, in excel vba i have added a commandbutton to userform... like below Set ctrl = Me.Controls.Add( _ bstrProgID:="Forms.CommandButton.1", _ Name:="CommandButton1", Visible:=True) Now I wanted to know how would I tell it what to do when it is clicked? thanks!! ...

Excel: filtering a time series graph

I have data that looks like the following: ID | Location | Attendees | StartDate | EndDate --------------------------------------------- Event1 | Bldg 1 | 10 | June 1 | June 5 Event2 | Bldg 2 | 15 | June 3 | June 6 Event3 | Bldg 1 | 5 | June 3 | June 10 I'd like to create a time series grap...

Code that executes Selection.AutoFilter is not working on some PCs

Hi I have a problem when executing code like this on different computers. I have an Excel worksheet where dates are in 9 and 10 columns. I need to apply the following filter Dim sCriteria1 As String, sCriteria2 As String sCriteria1 = ">=" & Format(Date, "MM/dd/yyyy") sCriteria2 = "<" & Format(Date + 60, "MM/dd/yyyy") Selection.AutoFilt...

feeding data labels into excel with VBA

i have a scatter plot graph i would like each dot to have a label. how do i feed in labels through VBA for each dot? ...

Refresh Pivot Table With XML From ServerXMLHTTP Response

I have succesfully made an Ajax like request to a web service using Microsoft Excel. My goal is to have a button that the user can click to pull down the information and refresh the pivot tables and charts in the excel document to reflect the udpated information. Can I set the Pivot Table to have an XML as it's source? If not, what a...

Record cannot be read; no read permission on 'MSysObjects'

Hello, I'm trying to get a list of all tables from an Access 2007 database using VBA. I have followed this post: http://stackoverflow.com/questions/201282/how-to-get-table-names-from-access Using: SELECT MSysObjects.Name AS table_name FROM MSysObjects WHERE (((Left([Name],1))<>"~") AND ((Left([Name],4))<>"MSys") AND ((MSysObjects.Ty...

Macro not in the list after loading the add-in.

I have a created a macro show() and saved it as display.xla and open a new workbook and added the display add-in. But when i went to Tools->Macro->Macro.. its not the list, But if i type display.xla!show and click run im able to execute it. Is there anyway to display the macros stored in the Add-in.? Apart from having it in personal.xls...

excel programming

I am new to Excel programming. What are the differences among UDF, Macro, Add-in, Automation Add-in, XLL, VSTO which one I should use and under some circumstances? Thanks! ...

Copy data from multiple rows only if data exists.

I have a spreadsheet named "Data Sheet" that collects data from other worksheets via formulas and works perfectly. I need a macro that will copy the data from multiple rows so I can paste into a seperate workbook. I have 30 rows of data ranging from A3:EI3 to A32:EI32. This data is collected from 1 to 30 other sheets if they are made vis...

Distributing excel macro

I have created a excel macro, now i want it distribute to others who need to use it. All i want is if some one could please help me with steps to attach the macro to a custom tool bar button and then save both the custom tool bar and to .xla file. Then the users can store the .xla file on to XLSTART director and when excel is launched...

Closing C# object through excel code

I have created a C# library's COM object in VBA code (Excel). This C# library logs all messages in the log file. I have written some code in finally method and wish to invoke it each time I close the object through excel. But whenever I close the object through excel it does not call the code available in finally method. Please suggest h...

Losing ActiveCell.Value when closing TextBox from which value copied

Hi Programmers, So I'm using VBA UserForm in Excel to capture values. Problem is that after assigning value to ActiveCell and after value initially appearing in cell, The value disappears when I Close TextBox. I Think I Understand why this happens, just Don't know how to preserve value after closing TextBox. Thanks in Advance. ...

macro to copy and transpose every seventh row and past in new sheet.

I have surveys being done for my agents the system gives me a report in XML format. When I get the same changed to Excel I get the surveys in the below mentioned format Survey number Agent Name Rating 1 Rating 2 Rating 3 Rating 4 Rating 5 Comments With this format I have around 700 surveys every day and I need to get the same trans...

How to change chart colors in VBA

Hi. I have to change the colors of a pie chart in VBA. I 'managed' to change the font color, which is not what I wanted, this way: ActiveChart.Legend.LegendEntries(1).Border.ColorIndex = 6 I want to change the color of the actual piece of pie. I also have to set specific colors, which are part of the standard palette. The 6 above give...