excel-vba

How can I autofill cells in Excel using VBA?

I have some data in the first columns, some calculated fields right afterwards and I want to autofill the rest of the rows with the same rules that are in the first row. The total number of rows, number of columns for input/calculated data are known and I would appreciate a working example for this data: | A | B | C | D ...

Excel Macro is running using Cut/paste while users switch to email

My users are running Excel Macros, which are using Cut and Paste functions. Now while the macro is running they are switching to email and other apps such as word. Now the question I have always wanted answered is will switching to another app affect what is running in the Excel Macro also add in the effect of the Excel macros running i...

How to get access to the metaproperties of a file (aspecially a mp3 file) with vba

I'm creating an excel-sheets that reads the tags from the MP3-files situated in a folder. Yet the time apparently is or calculated from data inside the MetaProperties of a file or is inside those data. When I use the Property MetaProperties VBA always provokes an error, even in using a copy of the example in adapting the appropiate data....

Object does not get created on Virtual PC

I have set up a virtual PC (XP SP3) for executing automation developed in VBA. This automation creates an object of few Dlls developed in C# and VB.Net. But when I execute the automation using this VPC machine; the required objects does not get created and automation fails. Please let me know what could be the reasons for the same and ho...

How do I add put a border around every 2 lines in excel worksheet

hi, can someone please give me some guidelines on this. I'm fairly new to VBA. After outputing data to a worksheet, i want to format it. How do I add put a border around every 2 lines in an excel worksheet using VBA? regards Kojo ...

Copying columns to a list in an Excel macro

How do I write a macro that copies columns into a list and inserts some words in between? Like follows: John Doe 1256 856 Jane Doe 5462 564 Tom... becomes John Doe word word word word 1256 word word 856 Jane Doe word word word word word 5462 word word 564 Tom..... The word is constant i...

VBA Assign a value to a cell inside a function?

Hi, Is there anyway that I can assign a value/name to cell within a function ? Thank you EDIT Sorry for being unclear, here is my requirement. I'm having a user defined function (=MyFunction()) which can be called from a excel sheet. Thus, I also having a menu button where I need to recall the all the functions calls to =MyFunction(...

SQL in VBA Macro

I have a VBA macro, and i wish to add the following SQL,,however being a newbie dont know how to break the query in the excel macro?,,this the query: strSQL = "select ( SELECT COUNT (DISTINCT CUSTOMER_ACCOUNT.ID) AS NUMBER_OF_ACCOUNTS_NOT_DELETED FROM CUSTOMER_ACCOUNT INNER JOIN ACCOUNT ON CUSTOMER_ACCOUNT.ACCOUNT_ID=ACCOUN...

VBA: Test network drive connection speed.

What is a good way for excel to test network connection speed to the network drive my excel project is stored on? Many of my clients have been complaining that my excel project runs too slow (running it off the network). This is because some of the offices have slower connections than others to the network drive where it (and its acces...

Macro to show SQL result based on users cell choice

Hi all i have the following code: Now what this code does is it gets the results from an SQL query and inserts them in a predefined cell which i specify in the code...what i want it to do,.,,is to insert the result of the query in a cell that the user chooses when he clicks on a button which i assign the macro below. So the flow would be...

How to find co-ordinates or Cell of picture object?

In Excel I have attached a picture to a cell using the following Sub InsertPic() Dim mPic As Picture With ActiveSheet.Range("D12") Set mPic = .Parent.Pictures.Insert("C:\abc.png") mPic.Top = .Top mPic.Left = .Left mPic.Placement = xlMoveAndSize End With End Sub Excel doesn't allow inse...

VBA Macro On Timer style to run code every set number of seconds, i.e. 120 seconds

I have a need to run a piece of code every 120 seconds. I am looking for an easy way to do this in VBA. I know that it would be possible to get the timer value from the Auto_Open event to prevent having to use a magic number, but I can't quite get how to fire off a timer to get something to run every 120 seconds. I don't really want...

Is there a workaround when hitting the maximum summands in =sum in an Excel formula?

I am hitting a limit when I try to assign a sum to a cells formula: cells(y,x).formula = "=sum(G65,H74,I38,J20,G22, .... ,K19,L22)" It seems as though I can't have more than 30 summands in a =sum formula. Is there a workaround for this problem? ...

How to check if a cell has a picture?

In Excel, I want to check if a specific cell for instance "C12" has a picture? How could I do this? ...

How can I remove blank line breaks from an excel cell with VB or a formula?

Hello, I have many cells where data is broken up into many lines; some of those lines are blank. Is there a VB function or formula to remove blank line breaks in Excel cells, or all line breaks? Many thanks! ...

Bugs in Excel's ActiveX combo boxes?

I have noticed that I get all sorts of annoying errors when: I have ActiveX comboboxes on a worksheet (not an excel form) The comboboxes have event code linked to them (eg, onchange events) I use their listfillrange or linkedcell properties (clearing these properties seems to alleviate a lot of problems) (Not sure if this is connected)...

How to force Excel VBA to use updated COM server

I'm developing a COM server to be used from Excel VBA. When I update the server (edit code, unregister, re-register) Excel seems to carry on using the original version of the COM server, not the updated version. The only way I have found to get it to use the updated version is to close and re-open Excel, which gets a bit irritating. I...

Is there tool that can port or compile excel VBA code to C#?

Hi, I don't know much about .net, but I am working on a project where a requirement is to port some Excel VBA code embedded in spreadsheets to standalone C# . Are they any tools that could automate (or semi-automate) this port or compile? How well do they work? ...

Excel VBA Application.OnTime. I think its a bad idea to use this... thoughts either way?

I have a number of users I support that are asking for things to happen automatically ( well more automagically but that's another point!). One want events to happen every 120 secs ( see my other question ) and also another wants 1 thing to happen say at 5pm each business day. This has to be on the Excel sheet so therefore VBA as addin...

Recover from fatal error in excel VBA Workbook_Open?

I stumbled on a way to crash excel in Workbook_Open while making an .xla It's still a toy project, so I've been able to just delete it and start over (and now I'm coming back with version control and baby steps.) However, assuming I didn't have those options, how would I possibly edit the .xla remove the fatal code, since I have to loa...